Merge "Fix bug in OOM avoidance for RepoGroup cache."
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Parsing an URL
308 !! input
309 http://fr.wikipedia.org/wiki/🍺
310 <!-- EasterEgg we love beer, better be able be able to link to it -->
311 !! result
312 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
313 </p>
314 !! end
315
316 !! test
317 Simple list
318 !! input
319 * Item 1
320 * Item 2
321 !! result
322 <ul><li> Item 1
323 </li><li> Item 2
324 </li></ul>
325
326 !! end
327
328 !! test
329 Italics and bold
330 !! input
331 * plain
332 * plain''italic''plain
333 * plain''italic''plain''italic''plain
334 * plain'''bold'''plain
335 * plain'''bold'''plain'''bold'''plain
336 * plain''italic''plain'''bold'''plain
337 * plain'''bold'''plain''italic''plain
338 * plain''italic'''bold-italic'''italic''plain
339 * plain'''bold''bold-italic''bold'''plain
340 * plain'''''bold-italic'''italic''plain
341 * plain'''''bold-italic''bold'''plain
342 * plain''italic'''bold-italic'''''plain
343 * plain'''bold''bold-italic'''''plain
344 * plain l'''italic''plain
345 * plain l''''bold''' plain
346 !! result
347 <ul><li> plain
348 </li><li> plain<i>italic</i>plain
349 </li><li> plain<i>italic</i>plain<i>italic</i>plain
350 </li><li> plain<b>bold</b>plain
351 </li><li> plain<b>bold</b>plain<b>bold</b>plain
352 </li><li> plain<i>italic</i>plain<b>bold</b>plain
353 </li><li> plain<b>bold</b>plain<i>italic</i>plain
354 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
355 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
356 </li><li> plain<i><b>bold-italic</b>italic</i>plain
357 </li><li> plain<b><i>bold-italic</i>bold</b>plain
358 </li><li> plain<i>italic<b>bold-italic</b></i>plain
359 </li><li> plain<b>bold<i>bold-italic</i></b>plain
360 </li><li> plain l'<i>italic</i>plain
361 </li><li> plain l'<b>bold</b> plain
362 </li></ul>
363
364 !! end
365
366 # this example taken from the simple/Moon article
367 !! test
368 Italics and possessives
369 !! input
370 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
371 !! result
372 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
373 </p>
374 !! end
375
376 ###
377 ### 2-quote opening sequence tests
378 ###
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,2)
381 !! input
382 ''foo''
383 !! result
384 <p><i>foo</i>
385 </p>
386 !!end
387
388
389 !! test
390 Italics and bold: 2-quote opening sequence: (2,3)
391 !! input
392 ''foo'''
393 !! result
394 <p><i>foo'</i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: 2-quote opening sequence: (2,4)
401 !! input
402 ''foo''''
403 !! result
404 <p><i>foo''</i>
405 </p>
406 !!end
407
408
409 !! test
410 Italics and bold: 2-quote opening sequence: (2,5) (php)
411 !! options
412 php
413 !! input
414 ''foo'''''
415 !! result
416 <p><i>foo</i>
417 </p>
418 !!end
419 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
420 !! test
421 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
422 !! options
423 parsoid
424 !! input
425 ''foo'''''
426 !! result
427 <p><i>foo</i><b></b>
428 </p>
429 !!end
430
431
432 ###
433 ### 3-quote opening sequence tests
434 ###
435
436 !! test
437 Italics and bold: 3-quote opening sequence: (3,2)
438 !! input
439 '''foo''
440 !! result
441 <p>'<i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 3-quote opening sequence: (3,3)
448 !! input
449 '''foo'''
450 !! result
451 <p><b>foo</b>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 3-quote opening sequence: (3,4)
458 !! input
459 '''foo''''
460 !! result
461 <p><b>foo'</b>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 3-quote opening sequence: (3,5) (php)
468 !! options
469 php
470 !! input
471 '''foo'''''
472 !! result
473 <p><b>foo</b>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 '''foo'''''
483 !! result
484 <p><b>foo<i></i></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 4-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 4-quote opening sequence: (4,2)
495 !! input
496 ''''foo''
497 !! result
498 <p>''<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 4-quote opening sequence: (4,3)
505 !! input
506 ''''foo'''
507 !! result
508 <p>'<b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 4-quote opening sequence: (4,4)
515 !! input
516 ''''foo''''
517 !! result
518 <p>'<b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 4-quote opening sequence: (4,5) (php)
525 !! options
526 php
527 !! input
528 ''''foo'''''
529 !! result
530 <p>'<b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 ''''foo'''''
540 !! result
541 <p>'<b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 5-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 5-quote opening sequence: (5,2) (php)
552 !! options
553 php
554 !! input
555 '''''foo''
556 !! result
557 <p><b><i>foo</i></b>
558 </p>
559 !!end
560 # Parsoid reverses the nesting order, compared to the PHP parser
561 !! test
562 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
563 !! options
564 parsoid
565 !! input
566 '''''foo''
567 !! result
568 <p><i><b>foo</b></i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 5-quote opening sequence: (5,3)
575 !! input
576 '''''foo'''
577 !! result
578 <p><i><b>foo</b></i>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 5-quote opening sequence: (5,4)
585 !! input
586 '''''foo''''
587 !! result
588 <p><i><b>foo'</b></i>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 5-quote opening sequence: (5,5)
595 !! input
596 '''''foo'''''
597 !! result
598 <p><i><b>foo</b></i>
599 </p>
600 !!end
601
602 ###
603 ### multiple quote sequences in a line
604 ###
605 !! test
606 Italics and bold: multiple quote sequences: (2,4,2)
607 !! input
608 ''foo''''bar''
609 !! result
610 <p><i>foo'<b>bar</b></i>
611 </p>
612 !!end
613
614
615 !! test
616 Italics and bold: multiple quote sequences: (2,4,3)
617 !! input
618 ''foo''''bar'''
619 !! result
620 <p><i>foo'<b>bar</b></i>
621 </p>
622 !!end
623
624
625 !! test
626 Italics and bold: multiple quote sequences: (2,4,4)
627 !! input
628 ''foo''''bar''''
629 !! result
630 <p><i>foo'<b>bar'</b></i>
631 </p>
632 !!end
633
634
635 !! test
636 Italics and bold: multiple quote sequences: (3,4,2) (php)
637 !! options
638 php
639 !! input
640 '''foo''''bar''
641 !! result
642 <p><b>foo'</b>bar
643 </p>
644 !!end
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
648 !! options
649 parsoid
650 !! input
651 '''foo''''bar''
652 !! result
653 <p><b>foo'</b>bar<i></i>
654 </p>
655 !!end
656
657
658 !! test
659 Italics and bold: multiple quote sequences: (3,4,3) (php)
660 !! options
661 php
662 !! input
663 '''foo''''bar'''
664 !! result
665 <p><b>foo'</b>bar
666 </p>
667 !!end
668 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
669 !! test
670 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
671 !! options
672 parsoid
673 !! input
674 '''foo''''bar'''
675 !! result
676 <p><b>foo'</b>bar<b></b>
677 </p>
678 !!end
679
680 ###
681 ### other quote tests
682 ###
683 !! test
684 Italics and bold: other quote tests: (2,3,5)
685 !! input
686 ''this is about '''foo's family'''''
687 !! result
688 <p><i>this is about <b>foo's family</b></i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: other quote tests: (2,(3,3),2)
695 !! input
696 ''this is about '''foo's''' family''
697 !! result
698 <p><i>this is about <b>foo's</b> family</i>
699 </p>
700 !!end
701
702
703 !! test
704 Italics and bold: other quote tests: (3,2,3,2)
705 !! input
706 '''this is about ''foo'''s family''
707 !! result
708 <p><b>this is about <i>foo</i></b><i>s family</i>
709 </p>
710 !!end
711
712
713 # The Parsoid team believes the PHP parser's output on this test is wrong.
714 # It only checks for convert-to-bold-on-single-character-word when the word
715 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
716 # This means that the bold token in position 2 (0-indexed) gets converted by
717 # parsoid, but doesn't get changed by the PHP parser.
718 !! test
719 Italics and bold: other quote tests: (3,2,3,3) (php)
720 !! options
721 php
722 !! input
723 '''this is about ''foo'''s family'''
724 !! result
725 <p>'<i>this is about </i>foo<b>s family</b>
726 </p>
727 !!end
728 # This is the output the Parsoid team believes to be correct.
729 !! test
730 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
731 !! options
732 parsoid
733 !! input
734 '''this is about ''foo'''s family'''
735 !! result
736 <p><b>this is about <i>foo'</i>s family</b>
737 </p>
738 !!end
739
740
741 !! test
742 Italics and bold: other quote tests: (3,(2,2),3)
743 !! input
744 '''this is about ''foo's'' family'''
745 !! result
746 <p><b>this is about <i>foo's</i> family</b>
747 </p>
748 !!end
749
750
751 !! test
752 Italicized possessive
753 !! input
754 The ''[[Main Page]]'''s talk page.
755 !! result
756 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
757 </p>
758 !! end
759
760 ###
761 ### Non-html5 tags
762 ###
763
764 !! test
765 Non-html5 tags should be accepted
766 !! input
767 <center>''foo''</center>
768 <big>''foo''</big>
769 <font>''foo''</font>
770 <strike>''foo''</strike>
771 <tt>''foo''</tt>
772 !! result
773 <center><i>foo</i></center>
774 <p><big><i>foo</i></big>
775 <font><i>foo</i></font>
776 <strike><i>foo</i></strike>
777 <tt><i>foo</i></tt>
778 </p>
779 !! end
780
781 ###
782 ### <nowiki> test cases
783 ###
784
785 !! test
786 <nowiki> unordered list
787 !! input
788 <nowiki>* This is not an unordered list item.</nowiki>
789 !! result
790 <p>* This is not an unordered list item.
791 </p>
792 !! end
793
794 !! test
795 <nowiki> spacing
796 !! input
797 <nowiki>Lorem ipsum dolor
798
799 sed abit.
800 sed nullum.
801
802 :and a colon
803 </nowiki>
804 !! result
805 <p>Lorem ipsum dolor
806
807 sed abit.
808 sed nullum.
809
810 :and a colon
811
812 </p>
813 !! end
814
815 !! test
816 nowiki 3
817 !! input
818 :There is not nowiki.
819 :There is <nowiki>nowiki</nowiki>.
820
821 #There is not nowiki.
822 #There is <nowiki>nowiki</nowiki>.
823
824 *There is not nowiki.
825 *There is <nowiki>nowiki</nowiki>.
826 !! result
827 <dl><dd>There is not nowiki.
828 </dd><dd>There is nowiki.
829 </dd></dl>
830 <ol><li>There is not nowiki.
831 </li><li>There is nowiki.
832 </li></ol>
833 <ul><li>There is not nowiki.
834 </li><li>There is nowiki.
835 </li></ul>
836
837 !! end
838
839 !! test
840 Entities inside <nowiki>
841 !! input
842 <nowiki>&lt;</nowiki>
843 !! result
844 <p>&lt;
845 </p>
846 !! end
847
848
849 ###
850 ### Comments
851 ###
852 !! test
853 Comments and Indent-Pre
854 !! input
855 <!-- comment 1 --> asdf
856
857 <!-- comment 1 --> asdf
858 <!-- comment 2 -->
859
860 <!-- comment 1 --> asdf
861 <!-- comment 2 -->xyz
862
863 <!-- comment 1 --> asdf
864 <!-- comment 2 --> xyz
865 !! result
866 <pre>asdf
867 </pre>
868 <pre>asdf
869 </pre>
870 <pre>asdf
871 </pre>
872 <p>xyz
873 </p>
874 <pre>asdf
875 xyz
876 </pre>
877 !! end
878
879 !! test
880 Comment test 2a
881 !! input
882 asdf
883 <!-- comment 1 -->
884 jkl
885 !! result
886 <p>asdf
887 jkl
888 </p>
889 !! end
890
891 !! test
892 Comment test 2b
893 !! input
894 asdf
895 <!-- comment 1 -->
896
897 jkl
898 !! result
899 <p>asdf
900 </p><p>jkl
901 </p>
902 !! end
903
904 !! test
905 Comment test 3
906 !! input
907 asdf
908 <!-- comment 1 -->
909 <!-- comment 2 -->
910 jkl
911 !! result
912 <p>asdf
913 jkl
914 </p>
915 !! end
916
917 !! test
918 Comment test 4
919 !! input
920 asdf<!-- comment 1 -->jkl
921 !! result
922 <p>asdfjkl
923 </p>
924 !! end
925
926 !! test
927 Comment spacing
928 !! input
929 a
930 <!-- foo --> b <!-- bar -->
931 c
932 !! result
933 <p>a
934 </p>
935 <pre> b
936 </pre>
937 <p>c
938 </p>
939 !! end
940
941 !! test
942 Comment whitespace
943 !! input
944 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
945 !! result
946
947 !! end
948
949 !! test
950 Comment semantics and delimiters
951 !! input
952 <!-- --><!----><!-----><!------>
953 !! result
954
955 !! end
956
957 !! test
958 Comment semantics and delimiters, redux
959 !! input
960 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
961 -- foo -- funky huh? ... -->
962 !! result
963
964 !! end
965
966 !! test
967 Comment semantics and delimiters: directors cut
968 !! input
969 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
970 everything starting with < followed by !-- until the first -- and > we see,
971 that wouldn't be valid XML however, since in XML -- has to terminate a comment
972 -->-->
973 !! result
974 <p>--&gt;
975 </p>
976 !! end
977
978 !! test
979 Comment semantics: nesting
980 !! input
981 <!--<!-- no, we're not going to do anything fancy here -->-->
982 !! result
983 <p>--&gt;
984 </p>
985 !! end
986
987 !! test
988 Comment semantics: unclosed comment at end
989 !! input
990 <!--This comment will run out to the end of the document
991 !! result
992
993 !! end
994
995 !! test
996 Comment in template title
997 !! input
998 {{f<!---->oo}}
999 !! result
1000 <p>FOO
1001 </p>
1002 !! end
1003
1004 !! test
1005 Comment on its own line post-expand
1006 !! input
1007 a
1008 {{blank}}<!---->
1009 b
1010 !! result
1011 <p>a
1012 </p><p>b
1013 </p>
1014 !! end
1015
1016 !! test
1017 Comment on its own line post-expand with non-significant whitespace
1018 !! input
1019 a
1020 {{blank}} <!---->
1021 b
1022 !! result
1023 <p>a
1024 </p><p>b
1025 </p>
1026 !! end
1027
1028 ###
1029 ### paragraph wraping tests
1030 ###
1031 !! test
1032 No block tags
1033 !! input
1034 a
1035
1036 b
1037 !! result
1038 <p>a
1039 </p><p>b
1040 </p>
1041 !! end
1042 !! test
1043 Block tag on one line
1044 !! input
1045 a <div>foo</div>
1046
1047 b
1048 !! result
1049 a <div>foo</div>
1050 <p>b
1051 </p>
1052 !! end
1053
1054 !! test
1055 Block tag on both lines
1056 !! input
1057 a <div>foo</div>
1058
1059 b <div>foo</div>
1060 !! result
1061 a <div>foo</div>
1062 b <div>foo</div>
1063
1064 !! end
1065
1066 !! test
1067 Multiple lines without block tags
1068 !! input
1069 <div>foo</div> a
1070 b
1071 c
1072 d<!--foo--> e
1073 x <div>foo</div> z
1074 !! result
1075 <div>foo</div> a
1076 <p>b
1077 c
1078 d e
1079 </p>
1080 x <div>foo</div> z
1081
1082 !! end
1083
1084 !! test
1085 Empty lines between lines with block tags
1086 !! input
1087 <div></div>
1088
1089
1090 <div></div>a
1091
1092 b
1093 <div>a</div>b
1094
1095 <div>b</div>d
1096
1097
1098 <div>e</div>
1099 !! result
1100 <div></div>
1101 <p><br />
1102 </p>
1103 <div></div>a
1104 <p>b
1105 </p>
1106 <div>a</div>b
1107 <div>b</div>d
1108 <p><br />
1109 </p>
1110 <div>e</div>
1111
1112 !! end
1113
1114 ###
1115 ### Preformatted text
1116 ###
1117 !! test
1118 Preformatted text
1119 !! input
1120 This is some
1121 Preformatted text
1122 With ''italic''
1123 And '''bold'''
1124 And a [[Main Page|link]]
1125 !! result
1126 <pre>This is some
1127 Preformatted text
1128 With <i>italic</i>
1129 And <b>bold</b>
1130 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1131 </pre>
1132 !! end
1133
1134 !! test
1135 Ident preformatting with inline content
1136 !! input
1137 a
1138 ''b''
1139 !! result
1140 <pre>a
1141 <i>b</i>
1142 </pre>
1143 !! end
1144
1145 !! test
1146 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1147 !! input
1148 <pre><nowiki>
1149 <b>
1150 <cite>
1151 <em>
1152 </nowiki></pre>
1153 !! result
1154 <pre>
1155 &lt;b&gt;
1156 &lt;cite&gt;
1157 &lt;em&gt;
1158 </pre>
1159
1160 !! end
1161
1162 !! test
1163 Regression with preformatted in <center>
1164 !! input
1165 <center>
1166 Blah
1167 </center>
1168 !! result
1169 <center>
1170 <pre>Blah
1171 </pre>
1172 </center>
1173
1174 !! end
1175
1176 # Expected output in the following test is not really expected (there should be
1177 # <pre> in the output) -- it's only testing for well-formedness.
1178 !! test
1179 Bug 6200: Preformatted in <blockquote>
1180 !! input
1181 <blockquote>
1182 Blah
1183 </blockquote>
1184 !! result
1185 <blockquote>
1186 Blah
1187 </blockquote>
1188
1189 !! end
1190
1191 !! test
1192 <pre> with attributes (bug 3202)
1193 !! input
1194 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1195 !! result
1196 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1197
1198 !! end
1199
1200 !! test
1201 <pre> with width attribute (bug 3202)
1202 !! input
1203 <pre width="8">Narrow screen goodies</pre>
1204 !! result
1205 <pre width="8">Narrow screen goodies</pre>
1206
1207 !! end
1208
1209 !! test
1210 <pre> with forbidden attribute (bug 3202)
1211 !! input
1212 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1213 !! result
1214 <pre width="8">Narrow screen goodies</pre>
1215
1216 !! end
1217
1218 !! test
1219 Entities inside <pre>
1220 !! input
1221 <pre>&lt;</pre>
1222 !! result
1223 <pre>&lt;</pre>
1224
1225 !! end
1226
1227 !! test
1228 <pre> with forbidden attribute values (bug 3202)
1229 !! input
1230 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1231 !! result
1232 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1233
1234 !! end
1235
1236 !! test
1237 <nowiki> inside <pre> (bug 13238)
1238 !! input
1239 <pre>
1240 <nowiki>
1241 </pre>
1242 <pre>
1243 <nowiki></nowiki>
1244 </pre>
1245 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1246 !! result
1247 <pre>
1248 &lt;nowiki&gt;
1249 </pre>
1250 <pre>
1251
1252 </pre>
1253 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1254
1255 !! end
1256
1257 !! test
1258 <nowiki> and <pre> preference (first one wins)
1259 !! input
1260 <pre>
1261 <nowiki>
1262 </pre>
1263 </nowiki>
1264 </pre>
1265
1266 <nowiki>
1267 <pre>
1268 <nowiki>
1269 </pre>
1270 </nowiki>
1271 </pre>
1272
1273 !! result
1274 <pre>
1275 &lt;nowiki&gt;
1276 </pre>
1277 <p>&lt;/nowiki&gt;
1278 &lt;/pre&gt;
1279 </p><p>
1280 &lt;pre&gt;
1281 &lt;nowiki&gt;
1282 &lt;/pre&gt;
1283
1284 &lt;/pre&gt;
1285 </p>
1286 !! end
1287
1288 !! test
1289 </pre> inside nowiki
1290 !! input
1291 <nowiki></pre></nowiki>
1292 !! result
1293 <p>&lt;/pre&gt;
1294 </p>
1295 !! end
1296
1297 !!test
1298 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1299 !!input
1300 {{echo|}}
1301 !!result
1302
1303 !!end
1304
1305 !!test
1306 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1307 !!input
1308 {{echo|
1309 foo}}
1310 !!result
1311 <p>foo
1312 </p>
1313 !!end
1314
1315 !! test
1316 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1317 !! input
1318 {{echo|a
1319 b}}
1320 !!result
1321 <pre>a
1322 </pre>
1323 <p>b
1324 </p>
1325 !!end
1326
1327 !! test
1328 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1329 !! input
1330 {{echo|a
1331 b
1332 c
1333 d
1334 e
1335 }}
1336 !!result
1337 <pre>a
1338 </pre>
1339 <p>b
1340 c
1341 </p>
1342 <pre>d
1343 </pre>
1344 <p>e
1345 </p>
1346 !!end
1347
1348 !!test
1349 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1350 !!input
1351 {{echo| foo}}
1352
1353 {{echo| foo}}{{echo| bar}}
1354
1355 {{echo| foo}}
1356 {{echo| bar}}
1357
1358 {{echo|<!--cmt--> foo}}
1359
1360 <!--cmt-->{{echo| foo}}
1361
1362 {{echo|{{echo| }}bar}}
1363 !!result
1364 <pre>foo
1365 </pre>
1366 <pre>foo bar
1367 </pre>
1368 <pre>foo
1369 bar
1370 </pre>
1371 <pre>foo
1372 </pre>
1373 <pre>foo
1374 </pre>
1375 <pre>bar
1376 </pre>
1377 !!end
1378
1379 !! test
1380 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1381 !! input
1382 {{echo| }}a
1383
1384 {{echo|
1385 }}a
1386
1387 {{echo|
1388 b}}
1389
1390 {{echo|a
1391 }}b
1392
1393 {{echo|a
1394 }} b
1395 !!result
1396 <pre>a
1397 </pre>
1398 <p><br />
1399 </p>
1400 <pre>a
1401 </pre>
1402 <p><br />
1403 </p>
1404 <pre>b
1405 </pre>
1406 <p>a
1407 </p>
1408 <pre>b
1409 </pre>
1410 <p>a
1411 </p>
1412 <pre>b
1413 </pre>
1414 !!end
1415
1416 !! test
1417 Templates: Single-line variant of parameter whitespace stripping test
1418 !! input
1419 {{echo| a}}
1420
1421 {{echo|1= a}}
1422
1423 {{echo|{{echo| a}}}}
1424
1425 {{echo|1={{echo| a}}}}
1426 !! result
1427 <pre>a
1428 </pre>
1429 <p>a
1430 </p>
1431 <pre>a
1432 </pre>
1433 <p>a
1434 </p>
1435 !! end
1436
1437 !! test
1438 Templates: Strip whitespace from named parameters, but not positional ones
1439 !! input
1440 {{echo|
1441 foo}}
1442
1443 {{echo|
1444 * foo}}
1445
1446 {{echo| 1 =
1447 foo}}
1448
1449 {{echo| 1 =
1450 * foo}}
1451 !! result
1452 <pre>foo
1453 </pre>
1454 <p><br />
1455 </p>
1456 <ul><li> foo
1457 </li></ul>
1458 <p>foo
1459 </p>
1460 <ul><li> foo
1461 </li></ul>
1462
1463 !! end
1464
1465 ###
1466 ### Parsoid-centric tests for testing RT edge cases for pre
1467 ###
1468
1469 !!test
1470 1a. Indent-Pre and Comments
1471 !!input
1472 a
1473 <!--a-->
1474 c
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p>c
1479 </p>
1480 !!end
1481
1482 !!test
1483 1b. Indent-Pre and Comments
1484 !!input
1485 a
1486 <!--a-->
1487 c
1488 !!result
1489 <pre>a
1490 </pre>
1491 <p>c
1492 </p>
1493 !!end
1494
1495 !!test
1496 1c. Indent-Pre and Comments
1497 !!input
1498 <!--a--> a
1499
1500 <!--a--> a
1501 !!result
1502 <pre> a
1503 </pre>
1504 <pre> a
1505 </pre>
1506 !!end
1507
1508 !!test
1509 2a. Indent-Pre and tables
1510 !!input
1511 {|
1512 |-
1513 !h1!!h2
1514 |foo||bar
1515 |}
1516 !!result
1517 <table>
1518
1519 <tr>
1520 <th>h1</th>
1521 <th>h2
1522 </th>
1523 <td>foo</td>
1524 <td>bar
1525 </td></tr></table>
1526
1527 !!end
1528
1529 !!test
1530 2b. Indent-Pre and tables
1531 !!input
1532 {|
1533 |-
1534 |foo
1535 |}
1536 !!result
1537 <table>
1538
1539 <tr>
1540 <td>foo
1541 </td></tr></table>
1542
1543 !!end
1544
1545 !!test
1546 2c. Indent-Pre and tables (bug 42252)
1547 !!input
1548 {|
1549 |+ foo
1550 ! | bar
1551 |}
1552 !!result
1553 <table>
1554 <caption> foo
1555 </caption>
1556 <tr>
1557 <th> bar
1558 </th></tr></table>
1559
1560 !!end
1561
1562 !!test
1563 3a. Indent-Pre and block tags (single-line html)
1564 !!input
1565 <p> foo </p>
1566 <div> foo </div>
1567 <span> foo </span>
1568 !!result
1569 <p> foo </p>
1570 <div> foo </div>
1571 <pre><span> foo </span>
1572 </pre>
1573 !!end
1574
1575 !!test
1576 3b. Indent-Pre and block tags (pre-content on separate line)
1577 !!input
1578 <p>
1579 foo
1580 </p>
1581
1582 <div>
1583 foo
1584 </div>
1585
1586 <center>
1587 foo
1588 </center>
1589
1590 <blockquote>
1591 foo
1592 </blockquote>
1593
1594 <table><tr><td>
1595 foo
1596 </td></tr></table>
1597
1598 <ul><li>
1599 foo
1600 </li></ul>
1601
1602 !!result
1603 <p>
1604 foo
1605 </p>
1606 <div>
1607 <pre>foo
1608 </pre>
1609 </div>
1610 <center>
1611 <pre>foo
1612 </pre>
1613 </center>
1614 <blockquote>
1615 foo
1616 </blockquote>
1617 <table><tr><td>
1618 <pre>foo
1619 </pre>
1620 </td></tr></table>
1621 <ul><li>
1622 foo
1623 </li></ul>
1624
1625 !!end
1626
1627 !!test
1628 4. Multiple spaces at start-of-line
1629 !!input
1630 <p> foo </p>
1631 foo
1632 {|
1633 |foo
1634 |}
1635 !!result
1636 <p> foo </p>
1637 <pre> foo
1638 </pre>
1639 <table>
1640 <tr>
1641 <td>foo
1642 </td></tr></table>
1643
1644 !!end
1645
1646 !! test
1647 5. White-space in indent-pre
1648 NOTE: the white-space char on 2nd line is significant
1649 !! input
1650 a<br/>
1651
1652 b
1653 !! result
1654 <pre>a<br />
1655
1656 b
1657 </pre>
1658 !! end
1659
1660 ###
1661 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1662 ###
1663
1664 !!test
1665 HTML-pre: 1. embedded newlines
1666 !!input
1667 <pre>foo</pre>
1668
1669 <pre>
1670 foo
1671 </pre>
1672
1673 <pre>
1674
1675 foo
1676 </pre>
1677
1678 <pre>
1679
1680
1681 foo
1682 </pre>
1683 !!result
1684 <pre>foo</pre>
1685 <pre>
1686 foo
1687 </pre>
1688 <pre>
1689
1690 foo
1691 </pre>
1692 <pre>
1693
1694
1695 foo
1696 </pre>
1697
1698 !!end
1699
1700 !!test
1701 HTML-pre: 2: indented text
1702 !!input
1703 <pre>
1704 foo
1705 </pre>
1706 !!result
1707 <pre>
1708 foo
1709 </pre>
1710
1711 !!end
1712
1713 !!test
1714 HTML-pre: 3: other wikitext
1715 !!input
1716 <pre>
1717 * foo
1718 # bar
1719 = no-h =
1720 '' no-italic ''
1721 [[ NoLink ]]
1722 </pre>
1723 !!result
1724 <pre>
1725 * foo
1726 # bar
1727 = no-h =
1728 '' no-italic ''
1729 [[ NoLink ]]
1730 </pre>
1731
1732 !!end
1733
1734 ###
1735 ### Definition lists
1736 ###
1737 !! test
1738 Simple definition
1739 !! input
1740 ; name : Definition
1741 !! result
1742 <dl><dt> name&#160;</dt><dd> Definition
1743 </dd></dl>
1744
1745 !! end
1746
1747 !! test
1748 Definition list for indentation only
1749 !! input
1750 : Indented text
1751 !! result
1752 <dl><dd> Indented text
1753 </dd></dl>
1754
1755 !! end
1756
1757 !! test
1758 Definition list with no space
1759 !! input
1760 ;name:Definition
1761 !! result
1762 <dl><dt>name</dt><dd>Definition
1763 </dd></dl>
1764
1765 !!end
1766
1767 !! test
1768 Definition list with URL link
1769 !! input
1770 ; http://example.com/ : definition
1771 !! result
1772 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1773 </dd></dl>
1774
1775 !! end
1776
1777 !! test
1778 Definition list with bracketed URL link
1779 !! input
1780 ;[http://www.example.com/ Example]:Something about it
1781 !! result
1782 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1783 </dd></dl>
1784
1785 !! end
1786
1787 !! test
1788 Definition list with wikilink containing colon
1789 !! input
1790 ; [[Help:FAQ]]: The least-read page on Wikipedia
1791 !! result
1792 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1793 </dd></dl>
1794
1795 !! end
1796
1797 # At Brion's and JeLuF's insistence... :)
1798 !! test
1799 Definition list with news link containing colon
1800 !! input
1801 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1802 !! result
1803 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1804 </dd></dl>
1805
1806 !! end
1807
1808 !! test
1809 Malformed definition list with colon
1810 !! input
1811 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1812 !! result
1813 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1814 </dt></dl>
1815
1816 !! end
1817
1818 !! test
1819 Definition lists: colon in external link text
1820 !! input
1821 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1822 !! result
1823 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1824 </dd></dl>
1825
1826 !! end
1827
1828 !! test
1829 Definition lists: colon in HTML attribute
1830 !! input
1831 ;<b style="display: inline">bold</b>
1832 !! result
1833 <dl><dt><b style="display: inline">bold</b>
1834 </dt></dl>
1835
1836 !! end
1837
1838 !! test
1839 Definition lists: self-closed tag
1840 !! input
1841 ;one<br/>two : two-line fun
1842 !! result
1843 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1844 </dd></dl>
1845
1846 !! end
1847
1848 !! test
1849 Bug 11748: Literal closing tags
1850 !! input
1851 <dl>
1852 <dt>test 1</dt>
1853 <dd>test test test test test</dd>
1854 <dt>test 2</dt>
1855 <dd>test test test test test</dd>
1856 </dl>
1857 !! result
1858 <dl>
1859 <dt>test 1</dt>
1860 <dd>test test test test test</dd>
1861 <dt>test 2</dt>
1862 <dd>test test test test test</dd>
1863 </dl>
1864
1865 !! end
1866
1867 !! test
1868 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1869 !! input
1870 <ul><li>
1871 ; term : description
1872 * unordered
1873 </li>
1874 </ul>
1875 !! result
1876 <ul><li>
1877 <dl><dt> term&#160;</dt><dd> description
1878 </dd></dl>
1879 <ul><li> unordered
1880 </li></ul>
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887
1888 Definition list with empty definition and following paragraph
1889 !! input
1890 ; term:
1891 Paragraph text
1892 !! result
1893 <dl><dt> term</dt><dd>
1894 </dd></dl>
1895 <p>Paragraph text
1896 </p>
1897 !! end
1898
1899 !! test
1900 Nested definition lists using html syntax
1901 !! input
1902 <dl><dd>
1903 <dl>
1904 <dd>Foo</dd>
1905 </dl>
1906 </dd></dl>
1907 !! result
1908 <dl><dd>
1909 <dl>
1910 <dd>Foo</dd>
1911 </dl>
1912 </dd></dl>
1913
1914 !! end
1915
1916 !! test
1917 Definition Lists: No nesting: Multiple dd's
1918 !! input
1919 ;x
1920 :a
1921 :b
1922 !! result
1923 <dl><dt>x
1924 </dt><dd>a
1925 </dd><dd>b
1926 </dd></dl>
1927
1928 !! end
1929
1930 !! test
1931 Definition Lists: Indentation: Regular
1932 !! input
1933 :i1
1934 ::i2
1935 :::i3
1936 !! result
1937 <dl><dd>i1
1938 <dl><dd>i2
1939 <dl><dd>i3
1940 </dd></dl>
1941 </dd></dl>
1942 </dd></dl>
1943
1944 !! end
1945
1946 !! test
1947 Definition Lists: Indentation: Missing 1st level
1948 !! input
1949 ::i2
1950 :::i3
1951 !! result
1952 <dl><dd><dl><dd>i2
1953 <dl><dd>i3
1954 </dd></dl>
1955 </dd></dl>
1956 </dd></dl>
1957
1958 !! end
1959
1960 !! test
1961 Definition Lists: Indentation: Multi-level indent
1962 !! input
1963 :::i3
1964 !! result
1965 <dl><dd><dl><dd><dl><dd>i3
1966 </dd></dl>
1967 </dd></dl>
1968 </dd></dl>
1969
1970 !! end
1971
1972 !! test
1973 Definition Lists: Hacky use to indent tables
1974 !! input
1975 ::{|
1976 |foo
1977 |bar
1978 |}
1979 this text
1980 should be left alone
1981 !! result
1982 <dl><dd><dl><dd><table>
1983 <tr>
1984 <td>foo
1985 </td>
1986 <td>bar
1987 </td></tr></table></dd></dl></dd></dl>
1988 <p>this text
1989 should be left alone
1990 </p>
1991 !! end
1992 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1993 ## as an empty dt item. It also ignores all but the last ";" when followed
1994 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1995 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1996 ## ";"s.
1997 ##
1998 ## Ex: ";;t2 ::d2" is transformed into:
1999 ##
2000 ## <dl>
2001 ## <dt>t2 </dt>
2002 ## <dd>
2003 ## <dl>
2004 ## <dt></dt>
2005 ## <dd>d2</dd>
2006 ## </dl>
2007 ## </dd>
2008 ## </dl>
2009 ##
2010 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2011 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2012 ##
2013 ## <dl>
2014 ## <dt>
2015 ## <dl>
2016 ## <dt>t2 </dt>
2017 ## <dd>:d2</dd>
2018 ## </dl>
2019 ## </dt>
2020 ## </dl>
2021 ##
2022 ## All Parsoid only definition list tests have this difference.
2023 ##
2024 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2025 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2026
2027 !! test
2028 Table / list interaction: indented table with lists in table contents
2029 !! input
2030 :{|
2031 |-
2032 | a
2033 * b
2034 |-
2035 | c
2036 * d
2037 |}
2038 !! result
2039 <dl><dd><table>
2040
2041 <tr>
2042 <td> a
2043 <ul><li> b
2044 </li></ul>
2045 </td></tr>
2046 <tr>
2047 <td> c
2048 <ul><li> d
2049 </li></ul>
2050 </td></tr></table></dd></dl>
2051
2052 !! end
2053
2054 !!test
2055 Table / list interaction: lists nested in tables nested in indented lists
2056 !!input
2057 :{|
2058 |
2059 :a
2060 :b
2061 |
2062 *c
2063 *d
2064 |}
2065
2066 *e
2067 *f
2068 !!result
2069 <dl><dd><table>
2070 <tr>
2071 <td>
2072 <dl><dd>a
2073 </dd><dd>b
2074 </dd></dl>
2075 </td>
2076 <td>
2077 <ul><li>c
2078 </li><li>d
2079 </li></ul>
2080 </td></tr></table></dd></dl>
2081 <ul><li>e
2082 </li><li>f
2083 </li></ul>
2084
2085 !!end
2086
2087 !! test
2088 Definition Lists: Nesting: Multi-level (Parsoid only)
2089 !! options
2090 parsoid
2091 !! input
2092 ;t1 :d1
2093 ;;t2 ::d2
2094 ;;;t3 :::d3
2095 !! result
2096 <dl>
2097 <dt>t1 </dt>
2098 <dd>d1</dd>
2099 <dt>
2100 <dl>
2101 <dt>t2 </dt>
2102 <dd>:d2</dd>
2103 <dt>
2104 <dl>
2105 <dt>t3 </dt>
2106 <dd>::d3</dd>
2107 </dl>
2108 </dt>
2109 </dl>
2110 </dt>
2111 </dl>
2112
2113
2114 !! end
2115
2116
2117 !! test
2118 Definition Lists: Nesting: Test 2 (Parsoid only)
2119 !! options
2120 parsoid
2121 !! input
2122 ;t1
2123 ::d2
2124 !! result
2125 <dl>
2126 <dt>t1</dt>
2127 <dd>
2128 <dl>
2129 <dd>d2</dd>
2130 </dl>
2131 </dd>
2132 </dl>
2133
2134 !! end
2135
2136
2137 !! test
2138 Definition Lists: Nesting: Test 3 (Parsoid only)
2139 !! options
2140 parsoid
2141 !! input
2142 :;t1
2143 ::::d2
2144 !! result
2145 <dl>
2146 <dd>
2147 <dl>
2148 <dt>t1</dt>
2149 <dd>
2150 <dl>
2151 <dd>
2152 <dl>
2153 <dd>d2</dd>
2154 </dl>
2155 </dd>
2156 </dl>
2157 </dd>
2158 </dl>
2159 </dd>
2160 </dl>
2161
2162 !! end
2163
2164
2165 !! test
2166 Definition Lists: Nesting: Test 4
2167 !! input
2168 ::;t3
2169 :::d3
2170 !! result
2171 <dl><dd><dl><dd><dl><dt>t3
2172 </dt><dd>d3
2173 </dd></dl>
2174 </dd></dl>
2175 </dd></dl>
2176
2177 !! end
2178
2179
2180 ## The Parsoid team believes the following three test exposes a
2181 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2182 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2183 !! test
2184 Definition Lists: Mixed Lists: Test 1 (php)
2185 !! options
2186 php
2187 !! input
2188 :;* foo
2189 ::* bar
2190 :; baz
2191 !! result
2192 <dl><dd><dl><dt><ul><li> foo
2193 </li><li> bar
2194 </li></ul>
2195 </dt></dl>
2196 <dl><dt> baz
2197 </dt></dl>
2198 </dd></dl>
2199
2200 !! end
2201 !! test
2202 Definition Lists: Mixed Lists: Test 1 (parsoid)
2203 !! options
2204 parsoid
2205 !! input
2206 :;* foo
2207 ::* bar
2208 :; baz
2209 !! result
2210 <dl><dd><dl><dt><ul><li> foo
2211 </li></ul></dt><dd><ul><li> bar
2212 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2213 !! end
2214
2215 !! test
2216 Definition Lists: Mixed Lists: Test 2
2217 !! input
2218 *: d1
2219 *: d2
2220 !! result
2221 <ul><li><dl><dd> d1
2222 </dd><dd> d2
2223 </dd></dl>
2224 </li></ul>
2225
2226 !! end
2227
2228
2229 !! test
2230 Definition Lists: Mixed Lists: Test 3
2231 !! input
2232 *::: d1
2233 *::: d2
2234 !! result
2235 <ul><li><dl><dd><dl><dd><dl><dd> d1
2236 </dd><dd> d2
2237 </dd></dl>
2238 </dd></dl>
2239 </dd></dl>
2240 </li></ul>
2241
2242 !! end
2243
2244
2245 !! test
2246 Definition Lists: Mixed Lists: Test 4
2247 !! input
2248 *;d1 :d2
2249 *;d3 :d4
2250 !! result
2251 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2252 </dd><dt>d3&#160;</dt><dd>d4
2253 </dd></dl>
2254 </li></ul>
2255
2256 !! end
2257
2258
2259 !! test
2260 Definition Lists: Mixed Lists: Test 5
2261 !! input
2262 *:d1
2263 *:: d2
2264 !! result
2265 <ul><li><dl><dd>d1
2266 <dl><dd> d2
2267 </dd></dl>
2268 </dd></dl>
2269 </li></ul>
2270
2271 !! end
2272
2273
2274 !! test
2275 Definition Lists: Mixed Lists: Test 6
2276 !! input
2277 #*:d1
2278 #*::: d3
2279 !! result
2280 <ol><li><ul><li><dl><dd>d1
2281 <dl><dd><dl><dd> d3
2282 </dd></dl>
2283 </dd></dl>
2284 </dd></dl>
2285 </li></ul>
2286 </li></ol>
2287
2288 !! end
2289
2290
2291 !! test
2292 Definition Lists: Mixed Lists: Test 7
2293 !! input
2294 :* d1
2295 :* d2
2296 !! result
2297 <dl><dd><ul><li> d1
2298 </li><li> d2
2299 </li></ul>
2300 </dd></dl>
2301
2302 !! end
2303
2304
2305 !! test
2306 Definition Lists: Mixed Lists: Test 8
2307 !! input
2308 :* d1
2309 ::* d2
2310 !! result
2311 <dl><dd><ul><li> d1
2312 </li></ul>
2313 <dl><dd><ul><li> d2
2314 </li></ul>
2315 </dd></dl>
2316 </dd></dl>
2317
2318 !! end
2319
2320
2321 !! test
2322 Definition Lists: Mixed Lists: Test 9
2323 !! input
2324 *;foo :bar
2325 !! result
2326 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2327 </dd></dl>
2328 </li></ul>
2329
2330 !! end
2331
2332
2333 !! test
2334 Definition Lists: Mixed Lists: Test 10
2335 !! input
2336 *#;foo :bar
2337 !! result
2338 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2339 </dd></dl>
2340 </li></ol>
2341 </li></ul>
2342
2343 !! end
2344
2345 # The Parsoid team disagrees with the PHP parser's seemingly-random
2346 # rules regarding dd/dt on the next two tests. Parsoid is more
2347 # consistent, and recognizes the shared nesting and keeps the
2348 # still-open tags around until the nesting is complete.
2349
2350 !! test
2351 Definition Lists: Mixed Lists: Test 11 (php)
2352 !! options
2353 php
2354 !! input
2355 *#*#;*;;foo :bar
2356 *#*#;boo :baz
2357 !! result
2358 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2359 </dt></dl>
2360 </dd></dl>
2361 </li></ul>
2362 </dd></dl>
2363 <dl><dt>boo&#160;</dt><dd>baz
2364 </dd></dl>
2365 </li></ol>
2366 </li></ul>
2367 </li></ol>
2368 </li></ul>
2369
2370 !! end
2371 !! test
2372 Definition Lists: Mixed Lists: Test 11 (parsoid)
2373 !! options
2374 parsoid
2375 !! input
2376 *#*#;*;;foo :bar
2377 *#*#;boo :baz
2378 !! result
2379 <ul><li><ol><li><ul><li><ol><li><dl><dt><ul><li><dl><dt><dl><dt>foo&nbsp;</dt><dd>bar
2380 </dd></dl></dt></dl></li></ul></dt><dt>boo&nbsp;</dt><dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2381 !! end
2382
2383
2384 !! test
2385 Definition Lists: Weird Ones: Test 1 (php)
2386 !! options
2387 php
2388 !! input
2389 *#;*::;; foo : bar (who uses this?)
2390 !! result
2391 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2392 </dt></dl>
2393 </dd></dl>
2394 </dd></dl>
2395 </dd></dl>
2396 </li></ul>
2397 </dd></dl>
2398 </li></ol>
2399 </li></ul>
2400
2401 !! end
2402 !! test
2403 Definition Lists: Weird Ones: Test 1 (parsoid)
2404 !! options
2405 parsoid
2406 !! input
2407 *#;*::;; foo : bar (who uses this?)
2408 !! result
2409 <ul><li><ol><li><dl><dt><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> foo&nbsp;</dt><dd> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2410 !! end
2411
2412 ###
2413 ### External links
2414 ###
2415 !! test
2416 External links: non-bracketed
2417 !! input
2418 Non-bracketed: http://example.com
2419 !! result
2420 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2421 </p>
2422 !! end
2423
2424 !! test
2425 External links: numbered
2426 !! input
2427 Numbered: [http://example.com]
2428 Numbered: [http://example.net]
2429 Numbered: [http://example.com]
2430 !! result
2431 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2432 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2433 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2434 </p>
2435 !!end
2436
2437 !! test
2438 External links: specified text
2439 !! input
2440 Specified text: [http://example.com link]
2441 !! result
2442 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2443 </p>
2444 !!end
2445
2446 !! test
2447 External links: trail
2448 !! input
2449 Linktrails should not work for external links: [http://example.com link]s
2450 !! result
2451 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2452 </p>
2453 !! end
2454
2455 !! test
2456 External links: dollar sign in URL
2457 !! input
2458 http://example.com/1$2345
2459 !! result
2460 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2461 </p>
2462 !! end
2463
2464 !! test
2465 External links: dollar sign in URL (named)
2466 !! input
2467 [http://example.com/1$2345]
2468 !! result
2469 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2470 </p>
2471 !!end
2472
2473 !! test
2474 External links: open square bracket forbidden in URL (bug 4377)
2475 !! input
2476 http://example.com/1[2345
2477 !! result
2478 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2479 </p>
2480 !! end
2481
2482 !! test
2483 External links: open square bracket forbidden in URL (named) (bug 4377)
2484 !! input
2485 [http://example.com/1[2345]
2486 !! result
2487 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2488 </p>
2489 !!end
2490
2491 !! test
2492 External links: nowiki in URL link text (bug 6230)
2493 !!input
2494 [http://example.com/ <nowiki>''example site''</nowiki>]
2495 !! result
2496 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2497 </p>
2498 !! end
2499
2500 !! test
2501 External links: newline forbidden in text (bug 6230 regression check)
2502 !! input
2503 [http://example.com/ first
2504 second]
2505 !! result
2506 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2507 second]
2508 </p>
2509 !!end
2510
2511 !! test
2512 External links: Pipe char between url and text
2513 !! input
2514 [http://example.com | link]
2515 !! result
2516 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2517 </p>
2518 !!end
2519
2520 !! test
2521 External links: protocol-relative URL in brackets
2522 !! input
2523 [//example.com/ Test]
2524 !! result
2525 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2526 </p>
2527 !! end
2528
2529 !! test
2530 External links: protocol-relative URL in brackets without text
2531 !! input
2532 [//example.com]
2533 !! result
2534 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2535 </p>
2536 !! end
2537
2538 !! test
2539 External links: protocol-relative URL in free text is left alone
2540 !! input
2541 //example.com/Foo
2542 !! result
2543 <p>//example.com/Foo
2544 </p>
2545 !!end
2546
2547 !! test
2548 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2549 !! input
2550 foo//example.com/Foo
2551 !! result
2552 <p>foo//example.com/Foo
2553 </p>
2554 !! end
2555
2556 !! test
2557 External image
2558 !! input
2559 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2560 !! result
2561 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2562 </p>
2563 !! end
2564
2565 !! test
2566 External image from https
2567 !! input
2568 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2569 !! result
2570 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2571 </p>
2572 !! end
2573
2574 !! test
2575 Link to non-http image, no img tag
2576 !! input
2577 Link to non-http image, no img tag: ftp://example.com/test.jpg
2578 !! result
2579 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2580 </p>
2581 !! end
2582
2583 !! test
2584 External links: terminating separator
2585 !! input
2586 Terminating separator: http://example.com/thing,
2587 !! result
2588 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2589 </p>
2590 !! end
2591
2592 !! test
2593 External links: intervening separator
2594 !! input
2595 Intervening separator: http://example.com/1,2,3
2596 !! result
2597 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2598 </p>
2599 !! end
2600
2601 !! test
2602 External links: old bug with URL in query
2603 !! input
2604 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2605 !! result
2606 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2607 </p>
2608 !! end
2609
2610 !! test
2611 External links: old URL-in-URL bug, mixed protocols
2612 !! input
2613 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2614 !! result
2615 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2616 </p>
2617 !!end
2618
2619 !! test
2620 External links: URL in text
2621 !! input
2622 URL in text: [http://example.com http://example.com]
2623 !! result
2624 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2625 </p>
2626 !! end
2627
2628 !! test
2629 External links: Clickable images
2630 !! input
2631 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2632 !! result
2633 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2634 </p>
2635 !!end
2636
2637 !! test
2638 External links: raw ampersand
2639 !! input
2640 Old &amp; use: http://x&y
2641 !! result
2642 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2643 </p>
2644 !! end
2645
2646 !! test
2647 External links: encoded ampersand
2648 !! input
2649 Old &amp; use: http://x&amp;y
2650 !! result
2651 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2652 </p>
2653 !! end
2654
2655 !! test
2656 External links: encoded equals (bug 6102)
2657 !! input
2658 http://example.com/?foo&#61;bar
2659 !! result
2660 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2661 </p>
2662 !! end
2663
2664 !! test
2665 External links: [raw ampersand]
2666 !! input
2667 Old &amp; use: [http://x&y]
2668 !! result
2669 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2670 </p>
2671 !! end
2672
2673 !! test
2674 External links: [encoded ampersand]
2675 !! input
2676 Old &amp; use: [http://x&amp;y]
2677 !! result
2678 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2679 </p>
2680 !! end
2681
2682 !! test
2683 External links: [encoded equals] (bug 6102)
2684 !! input
2685 [http://example.com/?foo&#61;bar]
2686 !! result
2687 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2688 </p>
2689 !! end
2690
2691 !! test
2692 External links: [IDN ignored character reference in hostname; strip it right off]
2693 !! input
2694 [http://e&zwnj;xample.com/]
2695 !! result
2696 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2697 </p>
2698 !! end
2699
2700 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2701 # Where an external link could easily circumvent the sanitization of the text of
2702 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2703 # test demands a higher standard. That's a bit strange.
2704 #
2705 # Example:
2706 #
2707 # http://e‌xample.com -> [http://example.com|http://example.com]
2708 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2709 #
2710 # The first example is sanitized, but the second is not. Any security benefits
2711 # from this production are trivial to circumvent. Either remove this test and
2712 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2713 # the test accordingly.
2714 #
2715 # All our love,
2716 # The Parsoid team.
2717 !! test
2718 External links: IDN ignored character reference in hostname; strip it right off
2719 !! input
2720 http://e&zwnj;xample.com/
2721 !! result
2722 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2723 </p>
2724 !! end
2725
2726 !! test
2727 External links: www.jpeg.org (bug 554)
2728 !! input
2729 http://www.jpeg.org
2730 !!result
2731 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2732 </p>
2733 !! end
2734
2735 !! test
2736 External links: URL within URL (original bug 2)
2737 !! input
2738 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2739 !! result
2740 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2741 </p>
2742 !! end
2743
2744 !! test
2745 BUG 361: URL inside bracketed URL
2746 !! input
2747 [http://www.example.com/foo http://www.example.com/bar]
2748 !! result
2749 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2750 </p>
2751 !! end
2752
2753 !! test
2754 BUG 361: URL within URL, not bracketed
2755 !! input
2756 http://www.example.com/foo?=http://www.example.com/bar
2757 !! result
2758 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2759 </p>
2760 !! end
2761
2762 !! test
2763 BUG 289: ">"-token in URL-tail
2764 !! input
2765 http://www.example.com/<hello>
2766 !! result
2767 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2768 </p>
2769 !!end
2770
2771 !! test
2772 BUG 289: literal ">"-token in URL-tail
2773 !! input
2774 http://www.example.com/<b>html</b>
2775 !! result
2776 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2777 </p>
2778 !!end
2779
2780 !! test
2781 BUG 289: ">"-token in bracketed URL
2782 !! input
2783 [http://www.example.com/<hello> stuff]
2784 !! result
2785 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2786 </p>
2787 !!end
2788
2789 !! test
2790 BUG 289: literal ">"-token in bracketed URL
2791 !! input
2792 [http://www.example.com/<b>html</b> stuff]
2793 !! result
2794 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2795 </p>
2796 !!end
2797
2798 !! test
2799 BUG 289: literal double quote at end of URL
2800 !! input
2801 http://www.example.com/"hello"
2802 !! result
2803 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2804 </p>
2805 !!end
2806
2807 !! test
2808 BUG 289: literal double quote in bracketed URL
2809 !! input
2810 [http://www.example.com/"hello" stuff]
2811 !! result
2812 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2813 </p>
2814 !!end
2815
2816 !! test
2817 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2818 !! input
2819 [http://www.example.com test]
2820 !! result
2821 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2822 </p>
2823 !! end
2824
2825 !! test
2826 External links: link text with spaces
2827 !! input
2828 [http://www.example.com a b c]
2829 [http://www.example.com ''a'' ''b'']
2830 !! result
2831 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2832 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2833 </p>
2834 !! end
2835
2836 !! test
2837 External links: wiki links within external link (Bug 3695)
2838 !! input
2839 [http://example.com [[wikilink]] embedded in ext link]
2840 !! result
2841 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2842 </p>
2843 !! end
2844
2845 !! test
2846 BUG 787: Links with one slash after the url protocol are invalid
2847 !! input
2848 http:/example.com
2849
2850 [http:/example.com title]
2851 !! result
2852 <p>http:/example.com
2853 </p><p>[http:/example.com title]
2854 </p>
2855 !! end
2856
2857 !! test
2858 Bracketed external links with template-generated invalid target
2859 !! input
2860 [{{echo|http:/example.com}} title]
2861 !! result
2862 <p>[http:/example.com title]
2863 </p>
2864 !! end
2865
2866 !! test
2867 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2868 !! input
2869 ''[http://example.com text'']
2870 [http://example.com '''text]'''
2871 ''Something [http://example.com in italic'']
2872 ''Something [http://example.com mixed''''', even bold]'''
2873 '''''Now [http://example.com both''''']
2874 !! result
2875 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2876 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2877 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2878 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2879 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2880 </p>
2881 !! end
2882
2883
2884 !! test
2885 Bug 4781: %26 in URL
2886 !! input
2887 http://www.example.com/?title=AT%26T
2888 !! result
2889 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2890 </p>
2891 !! end
2892
2893 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2894 # % is actually legal in HTML5. Any change in output would need testing though.
2895 !! test
2896 Bug 4781, 5267: %25 in URL
2897 !! input
2898 http://www.example.com/?title=100%25_Bran
2899 !! result
2900 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2901 </p>
2902 !! end
2903
2904 !! test
2905 Bug 4781, 5267: %28, %29 in URL
2906 !! input
2907 http://www.example.com/?title=Ben-Hur_%281959_film%29
2908 !! result
2909 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2910 </p>
2911 !! end
2912
2913
2914 !! test
2915 Bug 4781: %26 in autonumber URL
2916 !! input
2917 [http://www.example.com/?title=AT%26T]
2918 !! result
2919 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2920 </p>
2921 !! end
2922
2923 !! test
2924 Bug 4781, 5267: %26 in autonumber URL
2925 !! input
2926 [http://www.example.com/?title=100%25_Bran]
2927 !! result
2928 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2929 </p>
2930 !! end
2931
2932 !! test
2933 Bug 4781, 5267: %28, %29 in autonumber URL
2934 !! input
2935 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2936 !! result
2937 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2938 </p>
2939 !! end
2940
2941
2942 !! test
2943 Bug 4781: %26 in bracketed URL
2944 !! input
2945 [http://www.example.com/?title=AT%26T link]
2946 !! result
2947 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2948 </p>
2949 !! end
2950
2951 !! test
2952 Bug 4781, 5267: %26 in bracketed URL
2953 !! input
2954 [http://www.example.com/?title=100%25_Bran link]
2955 !! result
2956 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2957 </p>
2958 !! end
2959
2960 !! test
2961 Bug 4781, 5267: %28, %29 in bracketed URL
2962 !! input
2963 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2964 !! result
2965 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2966 </p>
2967 !! end
2968
2969 !! test
2970 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2971 !! input
2972 Some [http://example.com/ pretty ''italics'' and stuff]!
2973 !! result
2974 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2975 </p>
2976 !! end
2977
2978 !! test
2979 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2980 !! input
2981 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2982 !! result
2983 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
2984 </p>
2985 !! end
2986
2987 !! test
2988 External link containing double-single-quotes with no space separating the url from text in italics
2989 !! input
2990 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
2991 !! result
2992 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
2993 </p>
2994 !! end
2995
2996 !! test
2997 URL-encoding in URL functions (single parameter)
2998 !! input
2999 {{localurl:Some page|amp=&}}
3000 !! result
3001 <p>/index.php?title=Some_page&amp;amp=&amp;
3002 </p>
3003 !! end
3004
3005 !! test
3006 URL-encoding in URL functions (multiple parameters)
3007 !! input
3008 {{localurl:Some page|q=?&amp=&}}
3009 !! result
3010 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3011 </p>
3012 !! end
3013
3014 !! test
3015 Brackets in urls
3016 !! input
3017 http://example.com/index.php?foozoid%5B%5D=bar
3018
3019 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3020 !! result
3021 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3022 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3023 </p>
3024 !! end
3025
3026 !! test
3027 IPv6 urls (bug 21261)
3028 !! options
3029 disabled
3030 !! input
3031 http://[2404:130:0:1000::187:2]/index.php
3032 !! result
3033 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3034 </p>
3035 !! end
3036
3037 !! test
3038 Non-extlinks in brackets
3039 !! input
3040 [foo]
3041 [foo bar]
3042 [foo ''bar'']
3043 [fool's] errand
3044 [fool's errand]
3045 [{{echo|foo}}]
3046 [{{echo|foo}} bar]
3047 [{{echo|foo}} ''bar'']
3048 [{{echo|foo}}l's] errand
3049 [{{echo|foo}}l's errand]
3050 [url={{echo|foo}}]
3051 [url=http://example.com]
3052 !! result
3053 <p>[foo]
3054 [foo bar]
3055 [foo <i>bar</i>]
3056 [fool's] errand
3057 [fool's errand]
3058 [foo]
3059 [foo bar]
3060 [foo <i>bar</i>]
3061 [fool's] errand
3062 [fool's errand]
3063 [url=foo]
3064 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3065 </p>
3066 !! end
3067
3068 ###
3069 ### Quotes
3070 ###
3071
3072 !! test
3073 Quotes
3074 !! input
3075 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3076
3077 Normal text. '''''Bold italic text.''''' Normal text.
3078 !!result
3079 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3080 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3081 </p>
3082 !! end
3083
3084
3085 !! test
3086 Unclosed and unmatched quotes (php)
3087 !! options
3088 php
3089 !! input
3090 '''''Bold italic text '''with bold deactivated''' in between.'''''
3091
3092 '''''Bold italic text ''with italic deactivated'' in between.'''''
3093
3094 '''Bold text..
3095
3096 ..spanning two paragraphs (should not work).'''
3097
3098 '''Bold tag left open
3099
3100 ''Italic tag left open
3101
3102 Normal text.
3103
3104 <!-- Unmatching number of opening, closing tags: -->
3105 '''This year''''s election ''should'' beat '''last year''''s.
3106
3107 ''Tom'''s car is bigger than ''Susan'''s.
3108
3109 Plain ''italic'''s plain
3110 !! result
3111 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3112 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3113 </p><p><b>Bold text..</b>
3114 </p><p>..spanning two paragraphs (should not work).
3115 </p><p><b>Bold tag left open</b>
3116 </p><p><i>Italic tag left open</i>
3117 </p><p>Normal text.
3118 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3119 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3120 </p><p>Plain <i>italic'</i>s plain
3121 </p>
3122 !! end
3123 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3124 # parser strips. The wikitext contains just the first half of the bold
3125 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3126 # differently than the PHP parser.)
3127 !! test
3128 Unclosed and unmatched quotes (parsoid)
3129 !! options
3130 parsoid
3131 !! input
3132 '''''Bold italic text '''with bold deactivated''' in between.'''''
3133
3134 '''''Bold italic text ''with italic deactivated'' in between.'''''
3135
3136 '''Bold text..
3137
3138 ..spanning two paragraphs (should not work).'''
3139
3140 '''Bold tag left open
3141
3142 ''Italic tag left open
3143
3144 Normal text.
3145
3146 <!-- Unmatching number of opening, closing tags: -->
3147 '''This year''''s election ''should'' beat '''last year''''s.
3148
3149 ''Tom'''s car is bigger than ''Susan'''s.
3150
3151 Plain ''italic'''s plain
3152 !! result
3153 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3154 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3155 </p><p><b>Bold text..</b>
3156 </p><p>..spanning two paragraphs (should not work).<b></b>
3157 </p><p><b>Bold tag left open</b>
3158 </p><p><i>Italic tag left open</i>
3159 </p><p>Normal text.
3160 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3161 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3162 </p><p>Plain <i>italic'</i>s plain
3163 </p>
3164 !! end
3165
3166 ###
3167 ### Tables
3168 ###
3169 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3170 ###
3171
3172 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3173 # is the bare minimun required by the spec, see:
3174 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3175 !! test
3176 A table with no data. (php)
3177 !! options
3178 php
3179 !! input
3180 {||}
3181 !! result
3182 !! end
3183 # Parsoid team replies: empty table tags are legal in HTML5
3184 !! test
3185 A table with no data. (parsoid)
3186 !! options
3187 parsoid
3188 !! input
3189 {||}
3190 !! result
3191 <table></table>
3192 !! end
3193
3194 # A table with nothing but a caption is invalid XHTML, we might want to render
3195 # this as <p>caption</p>
3196 !! test
3197 A table with nothing but a caption (php)
3198 !! options
3199 php
3200 !! input
3201 {|
3202 |+ caption
3203 |}
3204 !! result
3205 <table>
3206 <caption> caption
3207 </caption><tr><td></td></tr></table>
3208
3209 !! end
3210 # Parsoid team replies: table with only a caption is legal in HTML5
3211 !! test
3212 A table with nothing but a caption (parsoid)
3213 !! options
3214 parsoid
3215 !! input
3216 {|
3217 |+ caption
3218 |}
3219 !! result
3220 <table><caption> caption</caption></table>
3221 !! end
3222
3223 !! test
3224 A table with caption with default-spaced attributes and a table row
3225 !! input
3226 {|
3227 |+ style="color: red;" | caption1
3228 |-
3229 | foo
3230 |}
3231 !! result
3232 <table>
3233 <caption style="color: red;"> caption1
3234 </caption>
3235 <tr>
3236 <td> foo
3237 </td></tr></table>
3238
3239 !! end
3240
3241 !! test
3242 A table with captions with non-default spaced attributes and a table row
3243 !! input
3244 {|
3245 |+style="color: red;"|caption2
3246 |+ style="color: red;"| caption3
3247 |-
3248 | foo
3249 |}
3250 !! result
3251 <table>
3252 <caption style="color: red;">caption2
3253 </caption>
3254 <caption style="color: red;"> caption3
3255 </caption>
3256 <tr>
3257 <td> foo
3258 </td></tr></table>
3259
3260 !! end
3261
3262 !! test
3263 Table td-cell syntax variations
3264 !! input
3265 {|
3266 | foo bar foo | baz
3267 | foo bar foo || baz
3268 | style='color:red;' | baz
3269 | style='color:red;' || baz
3270 |}
3271 !! result
3272 <table>
3273 <tr>
3274 <td> baz
3275 </td>
3276 <td> foo bar foo </td>
3277 <td> baz
3278 </td>
3279 <td style="color:red;"> baz
3280 </td>
3281 <td> style='color:red;' </td>
3282 <td> baz
3283 </td></tr></table>
3284
3285 !! end
3286
3287 !! test
3288 Simple table
3289 !! input
3290 {|
3291 | 1 || 2
3292 |-
3293 | 3 || 4
3294 |}
3295 !! result
3296 <table>
3297 <tr>
3298 <td> 1 </td>
3299 <td> 2
3300 </td></tr>
3301 <tr>
3302 <td> 3 </td>
3303 <td> 4
3304 </td></tr></table>
3305
3306 !! end
3307
3308 !! test
3309 Simple table but with multiple dashes for row wikitext
3310 !! input
3311 {|
3312 | foo
3313 |-----
3314 | bar
3315 |}
3316 !! result
3317 <table>
3318 <tr>
3319 <td> foo
3320 </td></tr>
3321 <tr>
3322 <td> bar
3323 </td></tr></table>
3324
3325 !! end
3326 !! test
3327 Multiplication table
3328 !! input
3329 {| border="1" cellpadding="2"
3330 |+Multiplication table
3331 |-
3332 ! &times; !! 1 !! 2 !! 3
3333 |-
3334 ! 1
3335 | 1 || 2 || 3
3336 |-
3337 ! 2
3338 | 2 || 4 || 6
3339 |-
3340 ! 3
3341 | 3 || 6 || 9
3342 |-
3343 ! 4
3344 | 4 || 8 || 12
3345 |-
3346 ! 5
3347 | 5 || 10 || 15
3348 |}
3349 !! result
3350 <table border="1" cellpadding="2">
3351 <caption>Multiplication table
3352 </caption>
3353 <tr>
3354 <th> &#215; </th>
3355 <th> 1 </th>
3356 <th> 2 </th>
3357 <th> 3
3358 </th></tr>
3359 <tr>
3360 <th> 1
3361 </th>
3362 <td> 1 </td>
3363 <td> 2 </td>
3364 <td> 3
3365 </td></tr>
3366 <tr>
3367 <th> 2
3368 </th>
3369 <td> 2 </td>
3370 <td> 4 </td>
3371 <td> 6
3372 </td></tr>
3373 <tr>
3374 <th> 3
3375 </th>
3376 <td> 3 </td>
3377 <td> 6 </td>
3378 <td> 9
3379 </td></tr>
3380 <tr>
3381 <th> 4
3382 </th>
3383 <td> 4 </td>
3384 <td> 8 </td>
3385 <td> 12
3386 </td></tr>
3387 <tr>
3388 <th> 5
3389 </th>
3390 <td> 5 </td>
3391 <td> 10 </td>
3392 <td> 15
3393 </td></tr></table>
3394
3395 !! end
3396
3397 !! test
3398 Accept "||" in table headings
3399 !! input
3400 {|
3401 !h1 || h2
3402 |}
3403 !! result
3404 <table>
3405 <tr>
3406 <th>h1 </th>
3407 <th> h2
3408 </th></tr></table>
3409
3410 !! end
3411
3412 !! test
3413 Accept "||" in indented table headings
3414 !! input
3415 :{|
3416 !h1 || h2
3417 |}
3418 !! result
3419 <dl><dd><table>
3420 <tr>
3421 <th>h1 </th>
3422 <th> h2
3423 </th></tr></table></dd></dl>
3424
3425 !! end
3426
3427 !! test
3428 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3429 !! input
3430 {|
3431 !| h1
3432 || a
3433 |}
3434 !! result
3435 <table>
3436 <tr>
3437 <th> h1
3438 </th>
3439 <td> a
3440 </td></tr></table>
3441
3442 !! end
3443
3444 !!test
3445 Accept "| !" at start of line in tables (ignore !-attribute)
3446 !!input
3447 {|
3448 |-
3449 | !style="color:red" | bar
3450 |}
3451 !!result
3452 <table>
3453
3454 <tr>
3455 <td> bar
3456 </td></tr></table>
3457
3458 !!end
3459
3460 !!test
3461 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3462 !!input
3463 {|
3464 |-
3465 |style='color:red;'|+1
3466 |style='color:blue;'|-1
3467 |-
3468 | 1 || 2 || 3
3469 | 1 ||+2 ||-3
3470 |-
3471 | +1
3472 | -1
3473 |}
3474 !!result
3475 <table>
3476
3477 <tr>
3478 <td style="color:red;">+1
3479 </td>
3480 <td style="color:blue;">-1
3481 </td></tr>
3482 <tr>
3483 <td> 1 </td>
3484 <td> 2 </td>
3485 <td> 3
3486 </td>
3487 <td> 1 </td>
3488 <td>+2 </td>
3489 <td>-3
3490 </td></tr>
3491 <tr>
3492 <td> +1
3493 </td>
3494 <td> -1
3495 </td></tr></table>
3496
3497 !!end
3498
3499 !! test
3500 Table rowspan
3501 !! input
3502 {| border=1
3503 | Cell 1, row 1
3504 |rowspan=2| Cell 2, row 1 (and 2)
3505 | Cell 3, row 1
3506 |-
3507 | Cell 1, row 2
3508 | Cell 3, row 2
3509 |}
3510 !! result
3511 <table border="1">
3512 <tr>
3513 <td> Cell 1, row 1
3514 </td>
3515 <td rowspan="2"> Cell 2, row 1 (and 2)
3516 </td>
3517 <td> Cell 3, row 1
3518 </td></tr>
3519 <tr>
3520 <td> Cell 1, row 2
3521 </td>
3522 <td> Cell 3, row 2
3523 </td></tr></table>
3524
3525 !! end
3526
3527 !! test
3528 Nested table
3529 !! input
3530 {| border=1
3531 | &alpha;
3532 |
3533 {| bgcolor=#ABCDEF border=2
3534 |nested
3535 |-
3536 |table
3537 |}
3538 |the original table again
3539 |}
3540 !! result
3541 <table border="1">
3542 <tr>
3543 <td> &#945;
3544 </td>
3545 <td>
3546 <table bgcolor="#ABCDEF" border="2">
3547 <tr>
3548 <td>nested
3549 </td></tr>
3550 <tr>
3551 <td>table
3552 </td></tr></table>
3553 </td>
3554 <td>the original table again
3555 </td></tr></table>
3556
3557 !! end
3558
3559 !! test
3560 Invalid attributes in table cell (bug 1830)
3561 !! input
3562 {|
3563 |Cell:|broken
3564 |}
3565 !! result
3566 <table>
3567 <tr>
3568 <td>broken
3569 </td></tr></table>
3570
3571 !! end
3572
3573
3574 !! test
3575 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3576 !! input
3577 {|
3578 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3579 !! result
3580 <table>
3581 <tr>
3582 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3583 <td>]" onmouseover="alert(document.cookie)"&gt;test
3584 </td>
3585 </tr>
3586 </table>
3587
3588 !! end
3589
3590
3591 !! test
3592 Indented table markup mixed with indented pre content (proposed in bug 6200)
3593 !! input
3594 <table>
3595 <tr>
3596 <td>
3597 Text that should be rendered preformatted
3598 </td>
3599 </tr>
3600 </table>
3601 !! result
3602 <table>
3603 <tr>
3604 <td>
3605 <pre>Text that should be rendered preformatted
3606 </pre>
3607 </td>
3608 </tr>
3609 </table>
3610
3611 !! end
3612
3613 !! test
3614 Template-generated table cell attributes and cell content
3615 !! input
3616 {|
3617 |{{table_attribs}}
3618 |}
3619 !! result
3620 <table>
3621 <tr>
3622 <td style="color: red"> Foo
3623 </td></tr></table>
3624
3625 !! end
3626
3627 !! test
3628 Table with row followed by newlines and table heading
3629 !! input
3630 {|
3631 |-
3632
3633 ! foo
3634 |}
3635 !! result
3636 <table>
3637
3638
3639 <tr>
3640 <th> foo
3641 </th></tr></table>
3642
3643 !! end
3644
3645 !! test
3646 Table with empty line following the start tag
3647 !! input
3648 {|
3649
3650 |-
3651 | foo
3652 |}
3653 !! result
3654 <table>
3655
3656
3657 <tr>
3658 <td> foo
3659 </td></tr></table>
3660
3661 !! end
3662
3663 # FIXME: Preserve the attribute properly (with an empty string as value) in
3664 # the PHP parser. Parsoid implements the behavior below.
3665 !! test
3666 Table attributes with empty value
3667 !! options
3668 disabled
3669 !! input
3670 {|
3671 | style=| hello
3672 |}
3673 !! result
3674 <table>
3675 <tr>
3676 <td style=""> hello
3677 </td></tr></table>
3678
3679 !! end
3680
3681 !! test
3682 Wikitext table with a lot of comments
3683 !! input
3684 {|
3685 <!-- c0 -->
3686 | foo
3687 <!-- c1 -->
3688 |- <!-- c2 -->
3689 <!-- c3 -->
3690 |<!-- c4 -->
3691 <!-- c5 -->
3692 |}
3693 !! result
3694 <table>
3695 <tr>
3696 <td> foo
3697 </td></tr>
3698 <tr>
3699 <td>
3700 </td></tr></table>
3701
3702 !! end
3703
3704 !! test
3705 Wikitext table with double-line table cell
3706 !! input
3707 {|
3708 |a
3709 b
3710 |}
3711 !! result
3712 <table>
3713 <tr>
3714 <td>a
3715 <p>b
3716 </p>
3717 </td></tr></table>
3718
3719 !! end
3720
3721 !! test
3722 Table cell with a single comment
3723 !! input
3724 {|
3725 | <!-- c1 -->
3726 | a
3727 |}
3728 !! result
3729 <table>
3730 <tr>
3731 <td>
3732 </td>
3733 <td> a
3734 </td></tr></table>
3735
3736 !! end
3737
3738 # The expected HTML structure in this test is debatable. The PHP parser does
3739 # not parse this kind of table at all. The main focus for Parsoid is on
3740 # round-tripping, so this output is ok for now. TODO: revisit!
3741 !! test
3742 Wikitext table with html-syntax row (Parsoid)
3743 !! options
3744 parsoid
3745 !! input
3746 {|
3747 |-
3748 <td>foo</td>
3749 |}
3750 !! result
3751 <table>
3752 <tbody>
3753 <tr>
3754 <td>foo</td></tr></tbody></table>
3755 !! end
3756
3757 ###
3758 ### Internal links
3759 ###
3760 !! test
3761 Plain link, capitalized
3762 !! input
3763 [[Main Page]]
3764 !! result
3765 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3766 </p>
3767 !! end
3768
3769 !! test
3770 Plain link, uncapitalized
3771 !! input
3772 [[main Page]]
3773 !! result
3774 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3775 </p>
3776 !! end
3777
3778 !! test
3779 Piped link
3780 !! input
3781 [[Main Page|The Main Page]]
3782 !! result
3783 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3784 </p>
3785 !! end
3786
3787 !! test
3788 Broken link
3789 !! input
3790 [[Zigzagzogzagzig]]
3791 !! result
3792 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3793 </p>
3794 !! end
3795
3796 !! test
3797 Broken link with fragment
3798 !! input
3799 [[Zigzagzogzagzig#zug]]
3800 !! result
3801 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3802 </p>
3803 !! end
3804
3805 !! test
3806 Special page link with fragment
3807 !! input
3808 [[Special:Version#anchor]]
3809 !! result
3810 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3811 </p>
3812 !! end
3813
3814 !! test
3815 Nonexistent special page link with fragment
3816 !! input
3817 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3818 !! result
3819 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3820 </p>
3821 !! end
3822
3823 !! test
3824 Link with prefix
3825 !! input
3826 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3827 !! result
3828 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3829 </p>
3830 !! end
3831
3832 !! test
3833 Link with suffix
3834 !! input
3835 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3836 !! result
3837 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
3838 </p>
3839 !! end
3840
3841 !! article
3842 prefixed article
3843 !! text
3844 Some text
3845 !! endarticle
3846
3847 !! test
3848 Bug 43661: Piped links with identical prefixes
3849 !! input
3850 [[prefixed article|prefixed articles with spaces]]
3851
3852 [[prefixed article|prefixed articlesaoeu]]
3853
3854 [[Main Page|Main Page test]]
3855 !! result
3856 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3857 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3858 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3859 </p>
3860 !! end
3861
3862
3863 !! test
3864 Link with HTML entity in suffix / tail
3865 !! input
3866 [[Main Page]]&quot;, [[Main Page]]&#97;
3867 !! result
3868 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3869 </p>
3870 !! end
3871
3872 !! test
3873 Link with 3 brackets
3874 !! input
3875 [[[main page]]]
3876 !! result
3877 <p>[[[main page]]]
3878 </p>
3879 !! end
3880
3881 !! test
3882 Piped link with 3 brackets
3883 !! input
3884 [[[main page|the main page]]]
3885 !! result
3886 <p>[[[main page|the main page]]]
3887 </p>
3888 !! end
3889
3890 !! test
3891 Link with multiple pipes
3892 !! input
3893 [[Main Page|The|Main|Page]]
3894 !! result
3895 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3896 </p>
3897 !! end
3898
3899 !! test
3900 Link to namespaces
3901 !! input
3902 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3903 !! result
3904 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
3905 </p>
3906 !! end
3907
3908 !! test
3909 Piped link to namespace
3910 !! input
3911 [[Meta:Disclaimers|The disclaimers]]
3912 !! result
3913 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
3914 </p>
3915 !! end
3916
3917 !! test
3918 Link containing }
3919 !! input
3920 [[Usually caused by a typo (oops}]]
3921 !! result
3922 <p>[[Usually caused by a typo (oops}]]
3923 </p>
3924 !! end
3925
3926 !! test
3927 Link containing % (not as a hex sequence)
3928 !! input
3929 [[7% Solution]]
3930 !! result
3931 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3932 </p>
3933 !! end
3934
3935 !! test
3936 Link containing % as a single hex sequence interpreted to char
3937 !! input
3938 [[7%25 Solution]]
3939 !! result
3940 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3941 </p>
3942 !!end
3943
3944 !! test
3945 Link containing % as a double hex sequence interpreted to hex sequence
3946 !! input
3947 [[7%2525 Solution]]
3948 !! result
3949 <p>[[7%2525 Solution]]
3950 </p>
3951 !!end
3952
3953 !! test
3954 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3955 Example for such a section: == < ==
3956 !! input
3957 [[%23%3c]][[%23%3e]]
3958 !! result
3959 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3960 </p>
3961 !! end
3962
3963 !! test
3964 Link containing "<#" and ">#" as a hex sequences
3965 !! input
3966 [[%3c%23]][[%3e%23]]
3967 !! result
3968 <p>[[%3c%23]][[%3e%23]]
3969 </p>
3970 !! end
3971
3972 !! test
3973 Link containing double-single-quotes '' (bug 4598)
3974 !! input
3975 [[Lista d''e paise d''o munno]]
3976 !! result
3977 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
3978 </p>
3979 !! end
3980
3981 !! test
3982 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3983 !! input
3984 Some [[Link|pretty ''italics'' and stuff]]!
3985 !! result
3986 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
3987 </p>
3988 !! end
3989
3990 !! test
3991 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3992 !! input
3993 ''Some [[Link|pretty ''italics'' and stuff]]!
3994 !! result
3995 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
3996 </p>
3997 !! end
3998
3999 !! test
4000 Link with double quotes in title part (literal) and alternate part (interpreted)
4001 !! input
4002 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4003
4004 [[''Pentecoste'']]
4005
4006 [[''Pentecoste''|Pentecoste]]
4007
4008 [[''Pentecoste''|''Pentecoste'']]
4009 !! result
4010 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
4011 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
4012 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
4013 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
4014 </p>
4015 !! end
4016
4017 !! test
4018 Broken image links with HTML captions (bug 39700)
4019 !! input
4020 [[File:Nonexistent|<script></script>]]
4021 [[File:Nonexistent|100px|<script></script>]]
4022 [[File:Nonexistent|&lt;]]
4023 [[File:Nonexistent|a<i>b</i>c]]
4024 !! result
4025 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4026 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4027 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4028 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4029 </p>
4030 !! end
4031
4032 !! test
4033 Plain link to URL
4034 !! input
4035 [[http://www.example.com]]
4036 !! result
4037 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4038 </p>
4039 !! end
4040
4041 !! test
4042 Plain link to URL with link text
4043 !! input
4044 [[http://www.example.com Link text]]
4045 !! result
4046 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4047 </p>
4048 !! end
4049
4050 !! test
4051 Plain link to protocol-relative URL
4052 !! input
4053 [[//www.example.com]]
4054 !! result
4055 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4056 </p>
4057 !! end
4058
4059 !! test
4060 Plain link to protocol-relative URL with link text
4061 !! input
4062 [[//www.example.com Link text]]
4063 !! result
4064 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4065 </p>
4066 !! end
4067
4068 !! test
4069 Plain link to page with question mark in title
4070 !! input
4071 [[A?b]]
4072
4073 [[A?b|Baz]]
4074 !! result
4075 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4076 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4077 </p>
4078 !! end
4079
4080
4081 # I'm fairly sure the expected result here is wrong.
4082 # We want these to be URL links, not pseudo-pages with URLs for titles....
4083 # However the current output is also pretty screwy.
4084 #
4085 # ----
4086 # I'm changing it to match the current output--it arguably makes more
4087 # sense in the light of the test above. Old expected result was:
4088 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4089 #</p>
4090 # But I think this test is bordering on "garbage in, garbage out" anyway.
4091 # -- wtm
4092 !! test
4093 Piped link to URL
4094 !! input
4095 Piped link to URL: [[http://www.example.com|an example URL]]
4096 !! result
4097 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4098 </p>
4099 !! end
4100
4101 !! test
4102 BUG 2: [[page|http://url/]] should link to page, not http://url/
4103 !! input
4104 [[Main Page|http://url/]]
4105 !! result
4106 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4107 </p>
4108 !! end
4109
4110 !! test
4111 BUG 337: Escaped self-links should be bold
4112 !! options
4113 title=[[Bug462]]
4114 !! input
4115 [[Bu&#103;462]] [[Bug462]]
4116 !! result
4117 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4118 </p>
4119 !! end
4120
4121 !! test
4122 Self-link to section should not be bold
4123 !! options
4124 title=[[Main Page]]
4125 !! input
4126 [[Main Page#section]]
4127 !! result
4128 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4129 </p>
4130 !! end
4131
4132 !! article
4133 00
4134 !! text
4135 This is 00.
4136 !! endarticle
4137
4138 !!test
4139 Self-link to numeric title
4140 !!options
4141 title=[[0]]
4142 !!input
4143 [[0]]
4144 !!result
4145 <p><strong class="selflink">0</strong>
4146 </p>
4147 !!end
4148
4149 !!test
4150 Link to numeric-equivalent title
4151 !!options
4152 title=[[0]]
4153 !!input
4154 [[00]]
4155 !!result
4156 <p><a href="/wiki/00" title="00">00</a>
4157 </p>
4158 !!end
4159
4160 !! test
4161 <nowiki> inside a link
4162 !! input
4163 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4164 !! result
4165 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4166 </p>
4167 !! end
4168
4169 !! test
4170 Non-breaking spaces in title
4171 !! input
4172 [[&nbsp; Main &nbsp; Page &nbsp;]]
4173 !! result
4174 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4175 </p>
4176 !!end
4177
4178 !! test
4179 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4180 !! options
4181 language=ca
4182 !! input
4183 '''[[Main Page]]'''
4184 !! result
4185 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4186 </p>
4187 !! end
4188
4189 !! test
4190 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4191 !! options
4192 language=ca
4193 !! input
4194 ''[[Main Page]]''
4195 !! result
4196 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4197 </p>
4198 !! end
4199
4200 !! test
4201 Internal link with en linktrail: no apostrophes (bug 27473)
4202 !! options
4203 language=en
4204 !! input
4205 [[Something]]'nice
4206 !! result
4207 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4208 </p>
4209 !! end
4210
4211 !! test
4212 Internal link with ca linktrail with apostrophes (bug 27473)
4213 !! options
4214 language=ca
4215 !! input
4216 [[Something]]'nice
4217 !! result
4218 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4219 </p>
4220 !! end
4221
4222 !! test
4223 Internal link with kaa linktrail with apostrophes (bug 27473)
4224 !! options
4225 language=kaa
4226 !! input
4227 [[Something]]'nice
4228 !! result
4229 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
4230 </p>
4231 !! end
4232
4233 !! test
4234 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4235 !! input
4236 [[Foo| bar]]
4237
4238 [[Foo| ''bar'']]
4239
4240 [http://wp.org foo]
4241
4242 [http://wp.org ''foo'']
4243 !! result
4244 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4245 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
4246 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4247 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4248 </p>
4249 !! end
4250
4251 ###
4252 ### Interwiki links (see maintenance/interwiki.sql)
4253 ###
4254
4255 !! test
4256 Inline interwiki link
4257 !! input
4258 [[MeatBall:SoftSecurity]]
4259 !! result
4260 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4261 </p>
4262 !! end
4263
4264 !! test
4265 Inline interwiki link with empty title (bug 2372)
4266 !! input
4267 [[MeatBall:]]
4268 !! result
4269 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4270 </p>
4271 !! end
4272
4273 !! test
4274 Interwiki link encoding conversion (bug 1636)
4275 !! input
4276 *[[Wikipedia:ro:Olteni&#0355;a]]
4277 *[[Wikipedia:ro:Olteni&#355;a]]
4278 !! result
4279 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4280 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4281 </li></ul>
4282
4283 !! end
4284
4285 !! test
4286 Interwiki link with fragment (bug 2130)
4287 !! input
4288 [[MeatBall:SoftSecurity#foo]]
4289 !! result
4290 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4291 </p>
4292 !! end
4293
4294 !! test
4295 Interlanguage link
4296 !! input
4297 Blah blah blah
4298 [[zh:Chinese]]
4299 !!result
4300 <p>Blah blah blah
4301 </p>
4302 !! end
4303
4304 !! test
4305 Double interlanguage link
4306 !! input
4307 Blah blah blah
4308 [[es:Spanish]]
4309 [[zh:Chinese]]
4310 !!result
4311 <p>Blah blah blah
4312 </p>
4313 !! end
4314
4315 !! test
4316 Interlanguage link, with prefix links
4317 !! options
4318 language=ln
4319 !! input
4320 Blah blah blah
4321 [[zh:Chinese]]
4322 !!result
4323 <p>Blah blah blah
4324 </p>
4325 !! end
4326
4327 !! test
4328 Double interlanguage link, with prefix links (bug 8897)
4329 !! options
4330 language=ln
4331 !! input
4332 Blah blah blah
4333 [[es:Spanish]]
4334 [[zh:Chinese]]
4335 !!result
4336 <p>Blah blah blah
4337 </p>
4338 !! end
4339
4340 !! test
4341 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4342 !! options
4343 language=ln
4344 !! input
4345 [[WW&nbsp;II]]
4346 !!result
4347 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
4348 </p>
4349 !! end
4350
4351 ##
4352 ## XHTML tidiness
4353 ###
4354
4355 !! test
4356 <br> to <br />
4357 !! input
4358 1<br>2<br />3
4359 !! result
4360 <p>1<br />2<br />3
4361 </p>
4362 !! end
4363
4364 !! test
4365 Broken br tag sanitization
4366 !! input
4367 </br>
4368 !! result
4369 <p>&lt;/br&gt;
4370 </p>
4371 !! end
4372
4373 !! test
4374 Incorrecly removing closing slashes from correctly formed XHTML
4375 !! input
4376 <br style="clear:both;" />
4377 !! result
4378 <p><br style="clear:both;" />
4379 </p>
4380 !! end
4381
4382 !! test
4383 Failing to transform badly formed HTML into correct XHTML
4384 !! input
4385 <br style="clear: left;">
4386 <br style="clear: right;">
4387 <br style="clear: both;">
4388 !! result
4389 <p><br style="clear: left;" />
4390 <br style="clear: right;" />
4391 <br style="clear: both;" />
4392 </p>
4393 !!end
4394
4395 !! test
4396 Handling html with a div self-closing tag
4397 !! input
4398 <div title />
4399 <div title/>
4400 <div title/ >
4401 <div title=bar />
4402 <div title=bar/>
4403 <div title=bar/ >
4404 !! result
4405 <p>&lt;div title /&gt;
4406 &lt;div title/&gt;
4407 </p>
4408 <div>
4409 <p>&lt;div title=bar /&gt;
4410 &lt;div title=bar/&gt;
4411 </p>
4412 <div title="bar/"></div>
4413 </div>
4414
4415 !! end
4416
4417 !! test
4418 Handling html with a br self-closing tag
4419 !! input
4420 <br title />
4421 <br title/>
4422 <br title/ >
4423 <br title=bar />
4424 <br title=bar/>
4425 <br title=bar/ >
4426 !! result
4427 <p><br title="title" />
4428 <br title="title" />
4429 <br />
4430 <br title="bar" />
4431 <br title="bar" />
4432 <br title="bar/" />
4433 </p>
4434 !! end
4435
4436 !! test
4437 Horizontal ruler (should it add that extra space?)
4438 !! input
4439 <hr>
4440 <hr >
4441 foo <hr
4442 > bar
4443 !! result
4444 <hr />
4445 <hr />
4446 foo <hr /> bar
4447
4448 !! end
4449
4450 !! test
4451 Horizontal ruler -- 4+ dashes render hr
4452 !! input
4453 ----
4454 !! result
4455 <hr />
4456
4457 !! end
4458
4459 !! test
4460 Horizontal ruler -- eats additional dashes on the same line
4461 !! input
4462 ---------
4463 !! result
4464 <hr />
4465
4466 !! end
4467
4468 !! test
4469 Horizontal ruler -- does not collapse dashes on consecutive lines
4470 !! input
4471 ----
4472 ----
4473 !! result
4474 <hr />
4475 <hr />
4476
4477 !! end
4478
4479 !! test
4480 Horizontal ruler -- <4 dashes render as plain text
4481 !! input
4482 ---
4483 !! result
4484 <p>---
4485 </p>
4486 !! end
4487
4488 !! test
4489 Horizontal ruler -- Supports content following dashes on same line
4490 !! input
4491 ---- Foo
4492 !! result
4493 <hr /> Foo
4494
4495 !! end
4496
4497 ###
4498 ### Block-level elements
4499 ###
4500 !! test
4501 Common list
4502 !! input
4503 *Common list
4504 * item 2
4505 *item 3
4506 !! result
4507 <ul><li>Common list
4508 </li><li> item 2
4509 </li><li>item 3
4510 </li></ul>
4511
4512 !! end
4513
4514 !! test
4515 Numbered list
4516 !! input
4517 #Numbered list
4518 #item 2
4519 # item 3
4520 !! result
4521 <ol><li>Numbered list
4522 </li><li>item 2
4523 </li><li> item 3
4524 </li></ol>
4525
4526 !! end
4527
4528 !! test
4529 Mixed list
4530 !! input
4531 *Mixed list
4532 *# with numbers
4533 ** and bullets
4534 *# and numbers
4535 *bullets again
4536 **bullet level 2
4537 ***bullet level 3
4538 ***#Number on level 4
4539 **bullet level 2
4540 **#Number on level 3
4541 **#Number on level 3
4542 *#number level 2
4543 *Level 1
4544 *** Level 3
4545 #** Level 3, but ordered
4546 !! result
4547 <ul><li>Mixed list
4548 <ol><li> with numbers
4549 </li></ol>
4550 <ul><li> and bullets
4551 </li></ul>
4552 <ol><li> and numbers
4553 </li></ol>
4554 </li><li>bullets again
4555 <ul><li>bullet level 2
4556 <ul><li>bullet level 3
4557 <ol><li>Number on level 4
4558 </li></ol>
4559 </li></ul>
4560 </li><li>bullet level 2
4561 <ol><li>Number on level 3
4562 </li><li>Number on level 3
4563 </li></ol>
4564 </li></ul>
4565 <ol><li>number level 2
4566 </li></ol>
4567 </li><li>Level 1
4568 <ul><li><ul><li> Level 3
4569 </li></ul>
4570 </li></ul>
4571 </li></ul>
4572 <ol><li><ul><li><ul><li> Level 3, but ordered
4573 </li></ul>
4574 </li></ul>
4575 </li></ol>
4576
4577 !! end
4578
4579 !! test
4580 Nested lists 1
4581 !! input
4582 *foo
4583 **bar
4584 !! result
4585 <ul><li>foo
4586 <ul><li>bar
4587 </li></ul>
4588 </li></ul>
4589
4590 !! end
4591
4592 !! test
4593 Nested lists 2
4594 !! input
4595 **foo
4596 *bar
4597 !! result
4598 <ul><li><ul><li>foo
4599 </li></ul>
4600 </li><li>bar
4601 </li></ul>
4602
4603 !! end
4604
4605 !! test
4606 Nested lists 3 (first element empty)
4607 !! input
4608 *
4609 **bar
4610 !! result
4611 <ul><li>
4612 <ul><li>bar
4613 </li></ul>
4614 </li></ul>
4615
4616 !! end
4617
4618 !! test
4619 Nested lists 4 (first element empty)
4620 !! input
4621 **
4622 *bar
4623 !! result
4624 <ul><li><ul><li>
4625 </li></ul>
4626 </li><li>bar
4627 </li></ul>
4628
4629 !! end
4630
4631 !! test
4632 Nested lists 5 (both elements empty)
4633 !! input
4634 **
4635 *
4636 !! result
4637 <ul><li><ul><li>
4638 </li></ul>
4639 </li><li>
4640 </li></ul>
4641
4642 !! end
4643
4644 !! test
4645 Nested lists 6 (both elements empty)
4646 !! input
4647 *
4648 **
4649 !! result
4650 <ul><li>
4651 <ul><li>
4652 </li></ul>
4653 </li></ul>
4654
4655 !! end
4656
4657 !! test
4658 Nested lists 7 (skip initial nesting levels)
4659 !! input
4660 *** foo
4661 !! result
4662 <ul><li><ul><li><ul><li> foo
4663 </li></ul>
4664 </li></ul>
4665 </li></ul>
4666
4667 !! end
4668
4669 !! test
4670 Nested lists 8 (multiple nesting transitions)
4671 !! input
4672 * foo
4673 *** bar
4674 ** baz
4675 * boo
4676 !! result
4677 <ul><li> foo
4678 <ul><li><ul><li> bar
4679 </li></ul>
4680 </li><li> baz
4681 </li></ul>
4682 </li><li> boo
4683 </li></ul>
4684
4685 !! end
4686
4687 !! test
4688 1. Lists with start-of-line-transparent tokens before bullets: Comments
4689 !! input
4690 *foo
4691 *<!--cmt-->bar
4692 <!--cmt-->*baz
4693 !! result
4694 <ul><li>foo
4695 </li><li>bar
4696 </li><li>baz
4697 </li></ul>
4698
4699 !! end
4700
4701 !! test
4702 2. Lists with start-of-line-transparent tokens before bullets: Template close
4703 !! input
4704 *foo {{echo|bar
4705 }}*baz
4706 !! result
4707 <ul><li>foo bar
4708 </li><li>baz
4709 </li></ul>
4710
4711 !! end
4712
4713 !! test
4714 Unbalanced closing block tags break a list
4715 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4716 !! options
4717 disabled
4718 !! input
4719 <div>
4720 *a</div><div>
4721 *b</div>
4722 !! result
4723 <div>
4724 <ul><li>a
4725 </li></ul></div><div>
4726 <ul><li>b
4727 </li></ul></div>
4728 !! end
4729
4730 !! test
4731 Unbalanced closing non-block tags don't break a list
4732 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4733 !! options
4734 disabled
4735 !! input
4736 <span>
4737 *a</span><span>
4738 *b</span>
4739 !! result
4740 <p><span></span>
4741 </p>
4742 <ul><li>a<span></span>
4743 </li><li>b
4744 </li></ul>
4745 !! end
4746
4747 !! test
4748 Unclosed formatting tags that straddle lists are closed and reopened
4749 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4750 !! options
4751 disabled
4752 !! input
4753 # <s> a
4754 # b </s>
4755 !! result
4756 <ol><li> <s> a </s>
4757 </li><li> <s> b </s>
4758 </li></ol>
4759 !! end
4760
4761 !!test
4762 List embedded in a non-block tag
4763 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4764 !! options
4765 parsoid
4766 !!input
4767 <small>
4768 * foo
4769 </small>
4770 !!result
4771 <p><small></small></p>
4772 <small>
4773 <ul>
4774 <li> foo</li>
4775 </ul>
4776 </small>
4777 <p><small></small></p>
4778 !!end
4779
4780 !! test
4781 List items are not parsed correctly following a <pre> block (bug 785)
4782 !! input
4783 * <pre>foo</pre>
4784 * <pre>bar</pre>
4785 * zar
4786 !! result
4787 <ul><li> <pre>foo</pre>
4788 </li><li> <pre>bar</pre>
4789 </li><li> zar
4790 </li></ul>
4791
4792 !! end
4793
4794 !! test
4795 List items from template
4796 !! input
4797
4798 {{inner list}}
4799 * item 2
4800
4801 * item 0
4802 {{inner list}}
4803 * item 2
4804
4805 * item 0
4806 * notSOL{{inner list}}
4807 * item 2
4808 !! result
4809 <ul><li> item 1
4810 </li><li> item 2
4811 </li></ul>
4812 <ul><li> item 0
4813 </li><li> item 1
4814 </li><li> item 2
4815 </li></ul>
4816 <ul><li> item 0
4817 </li><li> notSOL
4818 </li><li> item 1
4819 </li><li> item 2
4820 </li></ul>
4821
4822 !! end
4823
4824 !! test
4825 List interrupted by empty line or heading
4826 !! input
4827 * foo
4828
4829 ** bar
4830 == A heading ==
4831 * Another list item
4832 !! result
4833 <ul><li> foo
4834 </li></ul>
4835 <ul><li><ul><li> bar
4836 </li></ul>
4837 </li></ul>
4838 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span> <span class="mw-headline" id="A_heading">A heading</span></h2>
4839 <ul><li> Another list item
4840 </li></ul>
4841
4842 !!end
4843
4844 !!test
4845 Multiple list tags generated by templates
4846 !!input
4847 {{echo|<li>}}a
4848 {{echo|<li>}}b
4849 {{echo|<li>}}c
4850 !!result
4851 <li>a
4852 <li>b
4853 <li>c</li>
4854 </li>
4855 </li>
4856
4857 !!end
4858
4859 !!test
4860 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4861 !!input
4862 *a
4863 <!--This line will NOT split the list-->
4864 *b
4865 <!--This line will NOT split the list either-->
4866 *c
4867 <!--foo--> <!--This line with more than 1 comment will split the list-->
4868 *d
4869 !!result
4870 <ul><li>a
4871 </li><li>b
4872 </li><li>c
4873 </li></ul>
4874 <ul><li>d
4875 </li></ul>
4876
4877 !!end
4878
4879 ###
4880 ### Magic Words
4881 ###
4882
4883 !! test
4884 Magic Word: {{CURRENTDAY}}
4885 !! input
4886 {{CURRENTDAY}}
4887 !! result
4888 <p>1
4889 </p>
4890 !! end
4891
4892 !! test
4893 Magic Word: {{CURRENTDAY2}}
4894 !! input
4895 {{CURRENTDAY2}}
4896 !! result
4897 <p>01
4898 </p>
4899 !! end
4900
4901 !! test
4902 Magic Word: {{CURRENTDAYNAME}}
4903 !! input
4904 {{CURRENTDAYNAME}}
4905 !! result
4906 <p>Thursday
4907 </p>
4908 !! end
4909
4910 !! test
4911 Magic Word: {{CURRENTDOW}}
4912 !! input
4913 {{CURRENTDOW}}
4914 !! result
4915 <p>4
4916 </p>
4917 !! end
4918
4919 !! test
4920 Magic Word: {{CURRENTMONTH}}
4921 !! input
4922 {{CURRENTMONTH}}
4923 !! result
4924 <p>01
4925 </p>
4926 !! end
4927
4928 !! test
4929 Magic Word: {{CURRENTMONTHABBREV}}
4930 !! input
4931 {{CURRENTMONTHABBREV}}
4932 !! result
4933 <p>Jan
4934 </p>
4935 !! end
4936
4937 !! test
4938 Magic Word: {{CURRENTMONTHNAME}}
4939 !! input
4940 {{CURRENTMONTHNAME}}
4941 !! result
4942 <p>January
4943 </p>
4944 !! end
4945
4946 !! test
4947 Magic Word: {{CURRENTMONTHNAMEGEN}}
4948 !! input
4949 {{CURRENTMONTHNAMEGEN}}
4950 !! result
4951 <p>January
4952 </p>
4953 !! end
4954
4955 !! test
4956 Magic Word: {{CURRENTTIME}}
4957 !! input
4958 {{CURRENTTIME}}
4959 !! result
4960 <p>00:02
4961 </p>
4962 !! end
4963
4964 !! test
4965 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4966 !! input
4967 {{CURRENTWEEK}}
4968 !! result
4969 <p>1
4970 </p>
4971 !! end
4972
4973 !! test
4974 Magic Word: {{CURRENTYEAR}}
4975 !! input
4976 {{CURRENTYEAR}}
4977 !! result
4978 <p>1970
4979 </p>
4980 !! end
4981
4982 !! test
4983 Magic Word: {{FULLPAGENAME}}
4984 !! options
4985 title=[[User:Ævar Arnfjörð Bjarmason]]
4986 !! input
4987 {{FULLPAGENAME}}
4988 !! result
4989 <p>User:Ævar Arnfjörð Bjarmason
4990 </p>
4991 !! end
4992
4993 !! test
4994 Magic Word: {{FULLPAGENAMEE}}
4995 !! options
4996 title=[[User:Ævar Arnfjörð Bjarmason]]
4997 !! input
4998 {{FULLPAGENAMEE}}
4999 !! result
5000 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5001 </p>
5002 !! end
5003
5004 !! test
5005 Magic Word: {{NAMESPACE}}
5006 !! options
5007 title=[[User:Ævar Arnfjörð Bjarmason]]
5008 !! input
5009 {{NAMESPACE}}
5010 !! result
5011 <p>User
5012 </p>
5013 !! end
5014
5015 !! test
5016 Magic Word: {{NAMESPACEE}}
5017 !! options
5018 title=[[User:Ævar Arnfjörð Bjarmason]]
5019 !! input
5020 {{NAMESPACEE}}
5021 !! result
5022 <p>User
5023 </p>
5024 !! end
5025
5026 !! test
5027 Magic Word: {{NAMESPACENUMBER}}
5028 !! options
5029 title=[[User:Ævar Arnfjörð Bjarmason]]
5030 !! input
5031 {{NAMESPACENUMBER}}
5032 !! result
5033 <p>2
5034 </p>
5035 !! end
5036
5037 !! test
5038 Magic Word: {{NUMBEROFFILES}}
5039 !! input
5040 {{NUMBEROFFILES}}
5041 !! result
5042 <p>3
5043 </p>
5044 !! end
5045
5046 !! test
5047 Magic Word: {{PAGENAME}}
5048 !! options
5049 title=[[User:Ævar Arnfjörð Bjarmason]]
5050 !! input
5051 {{PAGENAME}}
5052 !! result
5053 <p>Ævar Arnfjörð Bjarmason
5054 </p>
5055 !! end
5056
5057 !! test
5058 Magic Word: {{PAGENAME}} with metacharacters
5059 !! options
5060 title=[['foo & bar = baz']]
5061 !! input
5062 ''{{PAGENAME}}''
5063 !! result
5064 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5065 </p>
5066 !! end
5067
5068 !! test
5069 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5070 !! options
5071 title=[[*RFC 1234 http://example.com/]]
5072 !! input
5073 {{PAGENAME}}
5074 !! result
5075 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5076 </p>
5077 !! end
5078
5079 !! test
5080 Magic Word: {{PAGENAMEE}}
5081 !! options
5082 title=[[User:Ævar Arnfjörð Bjarmason]]
5083 !! input
5084 {{PAGENAMEE}}
5085 !! result
5086 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5087 </p>
5088 !! end
5089
5090 !! test
5091 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5092 !! options
5093 title=[[*RFC 1234 http://example.com/]]
5094 !! input
5095 {{PAGENAMEE}}
5096 !! result
5097 <p>&#42;RFC_1234_http&#58;//example.com/
5098 </p>
5099 !! end
5100
5101 !! test
5102 Magic Word: {{REVISIONID}}
5103 !! input
5104 {{REVISIONID}}
5105 !! result
5106 <p>1337
5107 </p>
5108 !! end
5109
5110 !! test
5111 Magic Word: {{SCRIPTPATH}}
5112 !! input
5113 {{SCRIPTPATH}}
5114 !! result
5115 <p>/
5116 </p>
5117 !! end
5118
5119 !! test
5120 Magic Word: {{SERVER}}
5121 !! input
5122 {{SERVER}}
5123 !! result
5124 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5125 </p>
5126 !! end
5127
5128 !! test
5129 Magic Word: {{SERVERNAME}}
5130 !! input
5131 {{SERVERNAME}}
5132 !! result
5133 <p>example.org
5134 </p>
5135 !! end
5136
5137 !! test
5138 Magic Word: {{SITENAME}}
5139 !! input
5140 {{SITENAME}}
5141 !! result
5142 <p>MediaWiki
5143 </p>
5144 !! end
5145
5146 !! test
5147 Case-sensitive magic words, when cased differently, should just be template transclusions
5148 !! input
5149 {{CurrentMonth}}
5150 {{currentday}}
5151 {{cURreNTweEK}}
5152 {{currentHour}}
5153 !! result
5154 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
5155 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
5156 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
5157 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
5158 </p>
5159 !! end
5160
5161 !! test
5162 Case-insensitive magic words should still work with weird casing.
5163 !! input
5164 {{sErVeRNaMe}}
5165 {{LCFirst:AOEU}}
5166 {{ucFIRST:aoeu}}
5167 {{SERver}}
5168 !! result
5169 <p>example.org
5170 aOEU
5171 Aoeu
5172 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5173 </p>
5174 !! end
5175
5176 !! test
5177 Namespace 1 {{ns:1}}
5178 !! input
5179 {{ns:1}}
5180 !! result
5181 <p>Talk
5182 </p>
5183 !! end
5184
5185 !! test
5186 Namespace 1 {{ns:01}}
5187 !! input
5188 {{ns:01}}
5189 !! result
5190 <p>Talk
5191 </p>
5192 !! end
5193
5194 !! test
5195 Namespace 0 {{ns:0}} (bug 4783)
5196 !! input
5197 {{ns:0}}
5198 !! result
5199
5200 !! end
5201
5202 !! test
5203 Namespace 0 {{ns:00}} (bug 4783)
5204 !! input
5205 {{ns:00}}
5206 !! result
5207
5208 !! end
5209
5210 !! test
5211 Namespace -1 {{ns:-1}}
5212 !! input
5213 {{ns:-1}}
5214 !! result
5215 <p>Special
5216 </p>
5217 !! end
5218
5219 !! test
5220 Namespace User {{ns:User}}
5221 !! input
5222 {{ns:User}}
5223 !! result
5224 <p>User
5225 </p>
5226 !! end
5227
5228 !! test
5229 Namespace User talk {{ns:User_talk}}
5230 !! input
5231 {{ns:User_talk}}
5232 !! result
5233 <p>User talk
5234 </p>
5235 !! end
5236
5237 !! test
5238 Namespace User talk {{ns:uSeR tAlK}}
5239 !! input
5240 {{ns:uSeR tAlK}}
5241 !! result
5242 <p>User talk
5243 </p>
5244 !! end
5245
5246 !! test
5247 Namespace File {{ns:File}}
5248 !! input
5249 {{ns:File}}
5250 !! result
5251 <p>File
5252 </p>
5253 !! end
5254
5255 !! test
5256 Namespace File {{ns:Image}}
5257 !! input
5258 {{ns:Image}}
5259 !! result
5260 <p>File
5261 </p>
5262 !! end
5263
5264 !! test
5265 Namespace (lang=de) Benutzer {{ns:User}}
5266 !! options
5267 language=de
5268 !! input
5269 {{ns:User}}
5270 !! result
5271 <p>Benutzer
5272 </p>
5273 !! end
5274
5275 !! test
5276 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5277 !! options
5278 language=de
5279 !! input
5280 {{ns:3}}
5281 !! result
5282 <p>Benutzer Diskussion
5283 </p>
5284 !! end
5285
5286
5287 !! test
5288 Urlencode
5289 !! input
5290 {{urlencode:hi world?!}}
5291 {{urlencode:hi world?!|WIKI}}
5292 {{urlencode:hi world?!|PATH}}
5293 {{urlencode:hi world?!|QUERY}}
5294 !! result
5295 <p>hi+world%3F%21
5296 hi_world%3F!
5297 hi%20world%3F%21
5298 hi+world%3F%21
5299 </p>
5300 !! end
5301
5302 ###
5303 ### Magic links
5304 ###
5305 !! test
5306 Magic links: internal link to RFC (bug 479)
5307 !! input
5308 [[RFC 123]]
5309 !! result
5310 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
5311 </p>
5312 !! end
5313
5314 !! test
5315 Magic links: RFC (bug 479)
5316 !! input
5317 RFC 822
5318 !! result
5319 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5320 </p>
5321 !! end
5322
5323 !! test
5324 Magic links: ISBN (bug 1937)
5325 !! input
5326 ISBN 0-306-40615-2
5327 !! result
5328 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5329 </p>
5330 !! end
5331
5332 !! test
5333 Magic links: PMID incorrectly converts space to underscore
5334 !! input
5335 PMID 1234
5336 !! result
5337 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5338 </p>
5339 !! end
5340
5341 ###
5342 ### Templates
5343 ####
5344
5345 !! test
5346 Nonexistent template
5347 !! input
5348 {{thistemplatedoesnotexist}}
5349 !! result
5350 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
5351 </p>
5352 !! end
5353
5354 !! test
5355 Template with invalid target containing tags
5356 !! input
5357 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5358 !! result
5359 <p>{{a<b>b</b>|foo|a=b|a = b}}
5360 </p>
5361 !! end
5362
5363 !! test
5364 Template with invalid target containing unclosed tag
5365 !! input
5366 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5367 !! result
5368 <p>{{a<b>|foo|a=b|a = b}}</b>
5369 </p>
5370 !! end
5371
5372 !! article
5373 Template:test
5374 !! text
5375 This is a test template
5376 !! endarticle
5377
5378 !! test
5379 Simple template
5380 !! input
5381 {{test}}
5382 !! result
5383 <p>This is a test template
5384 </p>
5385 !! end
5386
5387 !! test
5388 Template with explicit namespace
5389 !! input
5390 {{Template:test}}
5391 !! result
5392 <p>This is a test template
5393 </p>
5394 !! end
5395
5396
5397 !! article
5398 Template:paramtest
5399 !! text
5400 This is a test template with parameter {{{param}}}
5401 !! endarticle
5402
5403 !! test
5404 Template parameter
5405 !! input
5406 {{paramtest|param=foo}}
5407 !! result
5408 <p>This is a test template with parameter foo
5409 </p>
5410 !! end
5411
5412 !! article
5413 Template:paramtestnum
5414 !! text
5415 [[{{{1}}}|{{{2}}}]]
5416 !! endarticle
5417
5418 !! test
5419 Template unnamed parameter
5420 !! input
5421 {{paramtestnum|Main Page|the main page}}
5422 !! result
5423 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5424 </p>
5425 !! end
5426
5427 !! article
5428 Template:templatesimple
5429 !! text
5430 (test)
5431 !! endarticle
5432
5433 !! article
5434 Template:templateredirect
5435 !! text
5436 #redirect [[Template:templatesimple]]
5437 !! endarticle
5438
5439 !! article
5440 Template:templateasargtestnum
5441 !! text
5442 {{{{{1}}}}}
5443 !! endarticle
5444
5445 !! article
5446 Template:templateasargtest
5447 !! text
5448 {{template{{{templ}}}}}
5449 !! endarticle
5450
5451 !! article
5452 Template:templateasargtest2
5453 !! text
5454 {{{{{templ}}}}}
5455 !! endarticle
5456
5457 !! test
5458 Template with template name as unnamed argument
5459 !! input
5460 {{templateasargtestnum|templatesimple}}
5461 !! result
5462 <p>(test)
5463 </p>
5464 !! end
5465
5466 !! test
5467 Template with template name as argument
5468 !! input
5469 {{templateasargtest|templ=simple}}
5470 !! result
5471 <p>(test)
5472 </p>
5473 !! end
5474
5475 !! test
5476 Template with template name as argument (2)
5477 !! input
5478 {{templateasargtest2|templ=templatesimple}}
5479 !! result
5480 <p>(test)
5481 </p>
5482 !! end
5483
5484 !! article
5485 Template:templateasargtestdefault
5486 !! text
5487 {{{{{templ|templatesimple}}}}}
5488 !! endarticle
5489
5490 !! article
5491 Template:templa
5492 !! text
5493 '''templ'''
5494 !! endarticle
5495
5496 !! test
5497 Template with default value
5498 !! input
5499 {{templateasargtestdefault}}
5500 !! result
5501 <p>(test)
5502 </p>
5503 !! end
5504
5505 !! test
5506 Template with default value (value set)
5507 !! input
5508 {{templateasargtestdefault|templ=templa}}
5509 !! result
5510 <p><b>templ</b>
5511 </p>
5512 !! end
5513
5514 !! test
5515 Template redirect
5516 !! input
5517 {{templateredirect}}
5518 !! result
5519 <p>(test)
5520 </p>
5521 !! end
5522
5523 !! test
5524 Template with argument in separate line
5525 !! input
5526 {{ templateasargtest |
5527 templ = simple }}
5528 !! result
5529 <p>(test)
5530 </p>
5531 !! end
5532
5533 !! test
5534 Template with complex template as argument
5535 !! input
5536 {{paramtest|
5537 param ={{ templateasargtest |
5538 templ = simple }}}}
5539 !! result
5540 <p>This is a test template with parameter (test)
5541 </p>
5542 !! end
5543
5544 !! test
5545 Template with thumb image (with link in description)
5546 !! input
5547 {{paramtest|
5548 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5549 !! result
5550 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
5551
5552 !! end
5553
5554 !! article
5555 Template:complextemplate
5556 !! text
5557 {{{1}}} {{paramtest|
5558 param ={{{param}}}}}
5559 !! endarticle
5560
5561 !! test
5562 Template with complex arguments
5563 !! input
5564 {{complextemplate|
5565 param ={{ templateasargtest |
5566 templ = simple }}|[[Template:complextemplate|link]]}}
5567 !! result
5568 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5569 </p>
5570 !! end
5571
5572 !! test
5573 BUG 553: link with two variables in a piped link
5574 !! input
5575 {|
5576 |[[{{{1}}}|{{{2}}}]]
5577 |}
5578 !! result
5579 <table>
5580 <tr>
5581 <td>[[{{{1}}}|{{{2}}}]]
5582 </td></tr></table>
5583
5584 !! end
5585
5586 !! test
5587 Magic variable as template parameter
5588 !! input
5589 {{paramtest|param={{SITENAME}}}}
5590 !! result
5591 <p>This is a test template with parameter MediaWiki
5592 </p>
5593 !! end
5594
5595 !! article
5596 Template:linktest
5597 !! text
5598 [[{{{param}}}|link]]
5599 !! endarticle
5600
5601 !! test
5602 Template parameter as link source
5603 !! input
5604 {{linktest|param=Main Page}}
5605 !! result
5606 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5607 </p>
5608 !! end
5609
5610 !!test
5611 Template-generated attribute string (k='v')
5612 !!input
5613 <span {{attr_str|id|v1}}>bar</span>
5614 !!result
5615 <p><span id="v1">bar</span>
5616 </p>
5617 !!end
5618
5619 !!article
5620 Template:paramtest2
5621 !! text
5622 including another template, {{paramtest|param={{{arg}}}}}
5623 !! endarticle
5624
5625 !! test
5626 Template passing argument to another template
5627 !! input
5628 {{paramtest2|arg='hmm'}}
5629 !! result
5630 <p>including another template, This is a test template with parameter 'hmm'
5631 </p>
5632 !! end
5633
5634 !! article
5635 Template:Linktest2
5636 !! text
5637 Main Page
5638 !! endarticle
5639
5640 !! test
5641 Template as link source
5642 !! input
5643 [[{{linktest2}}]]
5644
5645 [[{{linktest2}}|Main Page]]
5646
5647 [[{{linktest2}}]]Page
5648 !! result
5649 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5650 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5651 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5652 </p>
5653 !! end
5654
5655
5656 !! article
5657 Template:loop1
5658 !! text
5659 {{loop2}}
5660 !! endarticle
5661
5662 !! article
5663 Template:loop2
5664 !! text
5665 {{loop1}}
5666 !! endarticle
5667
5668 !! test
5669 Template infinite loop
5670 !! input
5671 {{loop1}}
5672 !! result
5673 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5674 </p>
5675 !! end
5676
5677 !! test
5678 Template from main namespace
5679 !! input
5680 {{:Main Page}}
5681 !! result
5682 <p>blah blah
5683 </p>
5684 !! end
5685
5686 !! article
5687 Template:table
5688 !! text
5689 {|
5690 | 1 || 2
5691 |-
5692 | 3 || 4
5693 |}
5694 !! endarticle
5695
5696 !! test
5697 BUG 529: Template with table, not included at beginning of line
5698 !! input
5699 foo {{table}}
5700 !! result
5701 <p>foo
5702 </p>
5703 <table>
5704 <tr>
5705 <td> 1 </td>
5706 <td> 2
5707 </td></tr>
5708 <tr>
5709 <td> 3 </td>
5710 <td> 4
5711 </td></tr></table>
5712
5713 !! end
5714
5715 !! test
5716 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5717 !! input
5718 foo
5719 {{table}}
5720 !! result
5721 <p>foo
5722 </p>
5723 <table>
5724 <tr>
5725 <td> 1 </td>
5726 <td> 2
5727 </td></tr>
5728 <tr>
5729 <td> 3 </td>
5730 <td> 4
5731 </td></tr></table>
5732
5733 !! end
5734
5735 !! test
5736 BUG 41: Template parameters shown as broken links
5737 !! input
5738 {{{parameter}}}
5739 !! result
5740 <p>{{{parameter}}}
5741 </p>
5742 !! end
5743
5744 !! test
5745 Template with targets containing wikilinks
5746 !! input
5747 {{[[foo]]}}
5748
5749 {{[[{{echo|foo}}]]}}
5750
5751 {{{{echo|[[foo}}]]}}
5752 !! result
5753 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5754 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5755 </p><p>{{[[foo}}]]
5756 </p>
5757 !! end
5758
5759 !! article
5760 Template:MSGNW test
5761 !! text
5762 ''None'' of '''this''' should be
5763 * interpreted
5764 but rather passed unmodified
5765 {{test}}
5766 !! endarticle
5767
5768 # hmm, fix this or just deprecate msgnw and document its behavior?
5769 !! test
5770 msgnw keyword
5771 !! options
5772 disabled
5773 !! input
5774 {{msgnw:MSGNW test}}
5775 !! result
5776 <p>''None'' of '''this''' should be
5777 * interpreted
5778 but rather passed unmodified
5779 {{test}}
5780 </p>
5781 !! end
5782
5783 !! test
5784 int keyword
5785 !! input
5786 {{int:youhavenewmessages|lots of money|not!}}
5787 !! result
5788 <p>You have lots of money (not!).
5789 </p>
5790 !! end
5791
5792 !! article
5793 Template:Includes
5794 !! text
5795 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5796 !! endarticle
5797
5798 !! test
5799 <includeonly> and <noinclude> being included
5800 !! input
5801 {{Includes}}
5802 !! result
5803 <p>Foobar
5804 </p>
5805 !! end
5806
5807 !! article
5808 Template:Includes2
5809 !! text
5810 <onlyinclude>Foo</onlyinclude>bar
5811 !! endarticle
5812
5813 !! test
5814 <onlyinclude> being included
5815 !! input
5816 {{Includes2}}
5817 !! result
5818 <p>Foo
5819 </p>
5820 !! end
5821
5822
5823 !! article
5824 Template:Includes3
5825 !! text
5826 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5827 !! endarticle
5828
5829 !! test
5830 <onlyinclude> and <includeonly> being included
5831 !! input
5832 {{Includes3}}
5833 !! result
5834 <p>Foo
5835 </p>
5836 !! end
5837
5838 !! test
5839 <includeonly> and <noinclude> on a page
5840 !! input
5841 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5842 !! result
5843 <p>Foozar
5844 </p>
5845 !! end
5846
5847 !! test
5848 Un-closed <noinclude>
5849 !! input
5850 <noinclude>
5851 !! result
5852 !! end
5853
5854 !! test
5855 <onlyinclude> on a page
5856 !! input
5857 <onlyinclude>Foo</onlyinclude>bar
5858 !! result
5859 <p>Foobar
5860 </p>
5861 !! end
5862
5863 !! test
5864 Un-closed <onlyinclude>
5865 !! input
5866 <onlyinclude>
5867 !! result
5868 !! end
5869
5870 !!test
5871 Self-closed noinclude, includeonly, onlyinclude tags
5872 !!input
5873 <noinclude />
5874 <includeonly />
5875 <onlyinclude />
5876 !!result
5877 <p><br />
5878 </p>
5879 !!end
5880
5881 !!test
5882 Unbalanced includeonly and noinclude tags
5883 !!input
5884 {|
5885 |a</noinclude>
5886 |b</noinclude></noinclude>
5887 |c</noinclude></includeonly>
5888 |d</includeonly></includeonly>
5889 |}
5890 !!result
5891 <table>
5892 <tr>
5893 <td>a
5894 </td>
5895 <td>b
5896 </td>
5897 <td>c&lt;/includeonly&gt;
5898 </td>
5899 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5900 </td></tr></table>
5901
5902 !!end
5903
5904 !! article
5905 Template:Includeonly section
5906 !! text
5907 <includeonly>
5908 ==Includeonly section==
5909 </includeonly>
5910 ==Section T-1==
5911 !!endarticle
5912
5913 !! test
5914 Bug 6563: Edit link generation for section shown by <includeonly>
5915 !! input
5916 {{includeonly section}}
5917 !! result
5918 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2>
5919 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2>
5920
5921 !! end
5922
5923 # Uses same input as the contents of [[Template:Includeonly section]]
5924 !! test
5925 Bug 6563: Section extraction for section shown by <includeonly>
5926 !! options
5927 section=T-2
5928 !! input
5929 <includeonly>
5930 ==Includeonly section==
5931 </includeonly>
5932 ==Section T-2==
5933 !! result
5934 ==Section T-2==
5935 !! end
5936
5937 !! test
5938 Bug 6563: Edit link generation for section suppressed by <includeonly>
5939 !! input
5940 <includeonly>
5941 ==Includeonly section==
5942 </includeonly>
5943 ==Section 1==
5944 !! result
5945 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
5946
5947 !! end
5948
5949 !! test
5950 Bug 6563: Section extraction for section suppressed by <includeonly>
5951 !! options
5952 section=1
5953 !! input
5954 <includeonly>
5955 ==Includeonly section==
5956 </includeonly>
5957 ==Section 1==
5958 !! result
5959 ==Section 1==
5960 !! end
5961
5962 !! test
5963 Un-closed <includeonly>
5964 !! input
5965 <includeonly>
5966 !! result
5967 !! end
5968
5969 ###
5970 ### <includeonly> and <noinclude> in attributes
5971 ###
5972 !!test
5973 0. includeonly around the entire attribute
5974 !!input
5975 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5976 !!result
5977 <p><span id="v2">bar</span>
5978 </p>
5979 !!end
5980
5981 !!test
5982 1. includeonly in html attr key
5983 !!input
5984 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5985 !!result
5986 <p><span id="foo">bar</span>
5987 </p>
5988 !!end
5989
5990 !!test
5991 2. includeonly in html attr value
5992 !!input
5993 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5994 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5995 !!result
5996 <p><span id="v1">bar</span>
5997 <span id="v1">bar</span>
5998 </p>
5999 !!end
6000
6001 !!test
6002 3. includeonly in part of an attr value
6003 !!input
6004 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6005 !!result
6006 <p><span style="color:red;">bar</span>
6007 </p>
6008 !!end
6009
6010 ###
6011 ### Testing parsing of templates where a template arg
6012 ### has the same name as the template itself.
6013 ###
6014
6015 !! article
6016 Template:quote
6017 !! text
6018 {{{quote|{{{1}}}}}}
6019 !! endarticle
6020
6021 !!test
6022 Templates: Template Name/Arg clash: 1. Use of positional param
6023 !!input
6024 {{quote|foo}}
6025 !!result
6026 <p>foo
6027 </p>
6028 !!end
6029
6030 !!test
6031 Templates: Template Name/Arg clash: 2. Use of named param
6032 !!input
6033 {{quote|quote=foo}}
6034 !!result
6035 <p>foo
6036 </p>
6037 !!end
6038
6039 !!test
6040 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6041 !!input
6042 {{quote|quote}}
6043 !!result
6044 <p>quote
6045 </p>
6046 !!end
6047
6048 ###
6049 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6050 ###
6051
6052 !!test
6053 Templates: 1. Simple use
6054 !!input
6055 {{echo|Foo}}
6056 !!result
6057 <p>Foo
6058 </p>
6059 !!end
6060
6061 !!test
6062 Templates: 2. Inside a block tag
6063 !!input
6064 <div>{{echo|Foo}}</div>
6065 !!result
6066 <div>Foo</div>
6067
6068 !!end
6069
6070 !!test
6071 Templates: P-wrapping: 1a. Templates on consecutive lines
6072 !!input
6073 {{echo|Foo}}
6074 {{echo|bar}}
6075 !!result
6076 <p>Foo
6077 bar
6078 </p>
6079 !!end
6080
6081 !!test
6082 Templates: P-wrapping: 1b. Templates on consecutive lines
6083 !!input
6084 Foo
6085
6086 {{echo|bar}}
6087 {{echo|baz}}
6088 !!result
6089 <p>Foo
6090 </p><p>bar
6091 baz
6092 </p>
6093 !!end
6094
6095 !!test
6096 Templates: P-wrapping: 1c. Templates on consecutive lines
6097 !!input
6098 {{echo|Foo}}
6099 {{echo|bar}} <div>baz</div>
6100 !!result
6101 <p>Foo
6102 </p>
6103 bar <div>baz</div>
6104
6105 !!end
6106
6107 !!test
6108 Templates: Inline Text: 1. Multiple tmeplate uses
6109 !!input
6110 {{echo|Foo}}bar{{echo|baz}}
6111 !!result
6112 <p>Foobarbaz
6113 </p>
6114 !!end
6115
6116 !!test
6117 Templates: Inline Text: 2. Back-to-back template uses
6118 !!input
6119 {{echo|Foo}}{{echo|bar}}
6120 !!result
6121 <p>Foobar
6122 </p>
6123 !!end
6124
6125 !!test
6126 Templates: Block Tags: 1. Multiple template uses
6127 !!input
6128 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6129 !!result
6130 <div>Foo</div><div>bar</div><div>baz</div>
6131
6132 !!end
6133
6134 !!test
6135 Templates: Block Tags: 2. Back-to-back template uses
6136 !!input
6137 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6138 !!result
6139 <div>Foo</div><div>bar</div>
6140
6141 !!end
6142
6143 !!test
6144 Templates: Links: 1. Simple example
6145 !!input
6146 {{echo|[[Foo|bar]]}}
6147 !!result
6148 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6149 </p>
6150 !!end
6151
6152 !!test
6153 Templates: Links: 2. Generation of link href
6154 !!input
6155 [[{{echo|Foo}}|bar]]
6156 !!result
6157 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6158 </p>
6159 !!end
6160
6161 !!test
6162 Templates: Links: 3. Generation of part of a link href
6163 !!input
6164 [[Fo{{echo|o}}|bar]]
6165
6166 [[Foo{{echo|bar}}]]
6167
6168 [[Foo{{echo|bar}}baz]]
6169
6170 [[Foo{{echo|bar}}|bar]]
6171
6172 [[:Foo{{echo|bar}}]]
6173
6174 [[:Foo{{echo|bar}}|bar]]
6175 !!result
6176 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6177 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6178 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6179 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6180 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6181 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6182 </p>
6183 !!end
6184
6185 !!test
6186 Templates: Links: 4. Multiple templates generating link href
6187 !!input
6188 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6189 !!result
6190 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6191 </p>
6192 !!end
6193
6194 !!test
6195 Templates: Links: 5. Generation of link text
6196 !!input
6197 [[Foo|{{echo|bar}}]]
6198 !!result
6199 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6200 </p>
6201 !!end
6202
6203 !!test
6204 Templates: Links: 5. Nested templates (only outermost template should be marked)
6205 !!input
6206 {{echo|[[{{echo|Foo}}|bar]]}}
6207 !!result
6208 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6209 </p>
6210 !!end
6211
6212 !!test
6213 Templates: HTML Tag: 1. Generation of HTML attr. key
6214 !!input
6215 <div {{echo|style}}="color:red;">foo</div>
6216 !!result
6217 <div style="color:red;">foo</div>
6218
6219 !!end
6220
6221 !!test
6222 Templates: HTML Tag: 2. Generation of HTML attr. value
6223 !!input
6224 <div style={{echo|'color:red;'}}>foo</div>
6225 !!result
6226 <div style="color:red;">foo</div>
6227
6228 !!end
6229
6230 !!test
6231 Templates: HTML Tag: 3. Generation of HTML attr key and value
6232 !!input
6233 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6234 !!result
6235 <div style="color:red;">foo</div>
6236
6237 !!end
6238
6239 !!test
6240 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6241 !!input
6242 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6243 !!result
6244 <div title="This is a long title with just one piece templated">foo</div>
6245
6246 !!end
6247
6248 !!test
6249 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6250 !!input
6251 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6252 !!result
6253 <div title="This is a long title with just one piece templated">foo</div>
6254
6255 !!end
6256
6257 !!test
6258 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6259 !!input
6260 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6261 !!result
6262 <div title="This is a long title with just one piece templated">foo</div>
6263
6264 !!end
6265
6266 !!test
6267 Templates: HTML Tag: 7. Generation of partial attribute key string
6268 !!input
6269 <div st{{echo|yle}}="color:red;">foo</div>
6270 !!result
6271 <div style="color:red;">foo</div>
6272
6273 !!end
6274
6275 !!test
6276 Templates: HTML Tables: 1. Generating start of a HTML table
6277 !!input
6278 {{echo|<table><tr><td>foo</td>}}</tr></table>
6279 !!result
6280 <table><tr><td>foo</td></tr></table>
6281
6282 !!end
6283
6284 !!test
6285 Templates: HTML Tables: 2a. Generating middle of a HTML table
6286 !!input
6287 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6288 !!result
6289 <table><tr><td>foo</td></tr></table>
6290
6291 !!end
6292
6293 !!test
6294 Templates: HTML Tables: 2b. Generating middle of a HTML table
6295 !!input
6296 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6297 !!result
6298 <table><tr><td>foo</td></tr></table>
6299
6300 !!end
6301
6302 !!test
6303 Templates: HTML Tables: 3. Generating end of a HTML table
6304 !!input
6305 <table><tr>{{echo|<td>foo</td></tr></table>}}
6306 !!result
6307 <table><tr><td>foo</td></tr></table>
6308
6309 !!end
6310
6311 !!test
6312 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6313 !!input
6314 {{echo|<table>}}<tr><td>foo</td></tr></table>
6315 !!result
6316 <table><tr><td>foo</td></tr></table>
6317
6318 !!end
6319
6320 !!test
6321 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6322 !!input
6323 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6324 !!result
6325 <table><tr><td>foo</td></tr></table>
6326
6327 !!end
6328
6329 !!test
6330 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6331 !!input
6332 <table><tr>{{echo|<td>}}foo</td></tr></table>
6333 !!result
6334 <table><tr><td>foo</td></tr></table>
6335
6336 !!end
6337
6338 !!test
6339 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6340 !!input
6341 <table><tr><td>foo{{echo|</td>}}</tr></table>
6342 !!result
6343 <table><tr><td>foo</td></tr></table>
6344
6345 !!end
6346
6347 !!test
6348 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6349 !!input
6350 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6351 !!result
6352 <table><tr><td>foo</td></tr></table>
6353
6354 !!end
6355
6356 !!test
6357 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6358 !!input
6359 <table><tr><td>foo</td></tr>{{echo|</table>}}
6360 !!result
6361 <table><tr><td>foo</td></tr></table>
6362
6363 !!end
6364
6365 !!test
6366 Templates: Wiki Tables: 1a. Fostering of entire template content
6367 !!input
6368 {|
6369 {{echo|a}}
6370 |}
6371 !!result
6372 <table>
6373 a
6374 <tr><td></td></tr></table>
6375
6376 !!end
6377
6378 !!test
6379 Templates: Wiki Tables: 1b. Fostering of entire template content
6380 !!input
6381 {|
6382 {{echo|<div>}}
6383 foo
6384 {{echo|</div>}}
6385 |}
6386 !!result
6387 <table>
6388 <div>
6389 <p>foo
6390 </p>
6391 </div>
6392 <tr><td></td></tr></table>
6393
6394 !!end
6395
6396 !!test
6397 Templates: Wiki Tables: 2. Fostering of partial template content
6398 !!input
6399 {|
6400 {{echo|a
6401 <div>b</div>}}
6402 |}
6403 !!result
6404 <table>
6405 a
6406 <div>b</div>
6407 <tr><td></td></tr></table>
6408
6409 !!end
6410
6411 !!test
6412 Templates: Wiki Tables: 3. td-content via multiple templates
6413 !!input
6414 {|
6415 {{echo|{{pipe}}a}}{{echo|b}}
6416 |}
6417 !!result
6418 <table>
6419 <tr>
6420 <td>ab
6421 </td></tr></table>
6422
6423 !!end
6424
6425 !!test
6426 Templates: Wiki Tables: 4. Templated tags, no content
6427 !!input
6428 {{tbl-start}}
6429 {{tbl-end}}
6430 !!result
6431 <table>
6432 <tr><td></td></tr></table>
6433
6434 !!end
6435
6436 !!test
6437 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6438 !!input
6439 {{tbl-start}}
6440 |foo
6441 {{tbl-end}}
6442 !!result
6443 <table>
6444 <tr>
6445 <td>foo
6446 </td></tr></table>
6447
6448 !!end
6449
6450 !!test
6451 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6452 !!input
6453 {{tbl-start}}
6454 {{!}}foo
6455 {{tbl-end}}
6456 !!result
6457 <table>
6458 <tr>
6459 <td>foo
6460 </td></tr></table>
6461
6462 !!end
6463
6464 !!test
6465 Templates: Lists: Multi-line list-items via templates
6466 !!input
6467 *{{echo|a {{nonexistent|
6468 unused}}}}
6469 *{{echo|b {{nonexistent|
6470 unused}}}}
6471 !!result
6472 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6473 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6474 </li></ul>
6475
6476 !!end
6477
6478 !!test
6479 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6480 !!input
6481 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6482 !!result
6483 <p><i>ab</i>c<i>d</i>e
6484 </p>
6485 !!end
6486
6487 !!test
6488 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6489 (PHP parser generates misnested html)
6490 !! options
6491 disabled
6492 !!input
6493 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6494 !!result
6495 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6496 !!end
6497
6498 !!test
6499 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6500 (PHP parser generates misnested html)
6501 !! options
6502 disabled
6503 !!input
6504 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6505 !!result
6506 <div><i>a</i></div>
6507 <div><i>b</i>c<i>d</i></div>
6508 <div>e</div>
6509 !!end
6510
6511 !!test
6512 Templates: Ugly nesting: 4. Divs opened/closed across templates
6513 !!input
6514 a<div>b{{echo|c</div>d}}e
6515 !!result
6516 a<div>bc</div>de
6517
6518 !!end
6519
6520 !!test
6521 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6522 (Parsoid-centric)
6523 !! options
6524 parsoid
6525 !!input
6526 {|
6527 |{{echo|foo</table>}}
6528 |bar
6529 |}
6530 !!result
6531 <table about="#mwt1" typeof="mw:Object/Template ">
6532 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6533 bar</span><span about="#mwt1">
6534 </span>
6535 !!end
6536
6537 !!test
6538 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6539 (Parsoid-centric)
6540 !! options
6541 parsoid
6542 !!input
6543 <table>
6544 <tr>
6545 <td>
6546 <table>
6547 <tr>
6548 <td>1. {{echo|foo </table>}}</td>
6549 <td> bar </td>
6550 <td>2. {{echo|baz </table>}}</td>
6551 </tr>
6552 <tr>
6553 <td>abc</td>
6554 </tr>
6555 </table>
6556 </td>
6557 </tr>
6558 <tr>
6559 <td>xyz</td>
6560 </tr>
6561 </table>
6562 !!result
6563 <table about="#mwt1" typeof="mw:Object/Template">
6564 <tbody><tr >
6565 <td >
6566 <table >
6567 <tbody><tr >
6568 <td >1. foo </td></tr></tbody></table></td>
6569 <td > bar </td>
6570 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6571 </span><span about="#mwt1">
6572
6573 abc</span><span about="#mwt1">
6574 </span><span about="#mwt1">
6575 </span><span about="#mwt1">
6576 </span><span about="#mwt1">
6577 </span><span about="#mwt1">
6578
6579 xyz</span><span about="#mwt1">
6580 </span><span about="#mwt1">
6581 </span>
6582 !!end
6583
6584 !! test
6585 Templates: Ugly templates: 3. newline-only template parameter
6586 !! input
6587 foo {{echo|
6588 }}
6589 !! result
6590 <p>foo
6591 </p>
6592 !! end
6593
6594 # This looks like a bug: a single newline triggers p/br for some reason.
6595 !! test
6596 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6597 !! input
6598 {{echo|
6599 }}
6600 !! result
6601 <p><br />
6602 </p>
6603 !! end
6604
6605
6606 !!test
6607 Parser Functions: 1. Simple example
6608 !!input
6609 {{uc:foo}}
6610 !!result
6611 <p>FOO
6612 </p>
6613 !!end
6614
6615 !!test
6616 Parser Functions: 2. Nested use (only outermost should be marked up)
6617 !!input
6618 {{uc:{{lc:FOO}}}}
6619 !!result
6620 <p>FOO
6621 </p>
6622 !!end
6623
6624 ###
6625 ### Pre-save transform tests
6626 ###
6627 !! test
6628 pre-save transform: subst:
6629 !! options
6630 PST
6631 !! input
6632 {{subst:test}}
6633 !! result
6634 This is a test template
6635 !! end
6636
6637 !! test
6638 pre-save transform: normal template
6639 !! options
6640 PST
6641 !! input
6642 {{test}}
6643 !! result
6644 {{test}}
6645 !! end
6646
6647 !! test
6648 pre-save transform: nonexistent template
6649 !! options
6650 PST
6651 !! input
6652 {{thistemplatedoesnotexist}}
6653 !! result
6654 {{thistemplatedoesnotexist}}
6655 !! end
6656
6657
6658 !! test
6659 pre-save transform: subst magic variables
6660 !! options
6661 PST
6662 !! input
6663 {{subst:SITENAME}}
6664 !! result
6665 MediaWiki
6666 !! end
6667
6668 # This is bug 89, which I fixed. -- wtm
6669 !! test
6670 pre-save transform: subst: templates with parameters
6671 !! options
6672 pst
6673 !! input
6674 {{subst:paramtest|param="something else"}}
6675 !! result
6676 This is a test template with parameter "something else"
6677 !! end
6678
6679 !! article
6680 Template:nowikitest
6681 !! text
6682 <nowiki>'''not wiki'''</nowiki>
6683 !! endarticle
6684
6685 !! test
6686 pre-save transform: nowiki in subst (bug 1188)
6687 !! options
6688 pst
6689 !! input
6690 {{subst:nowikitest}}
6691 !! result
6692 <nowiki>'''not wiki'''</nowiki>
6693 !! end
6694
6695
6696 !! article
6697 Template:commenttest
6698 !! text
6699 This template has <!-- a comment --> in it.
6700 !! endarticle
6701
6702 !! test
6703 pre-save transform: comment in subst (bug 1936)
6704 !! options
6705 pst
6706 !! input
6707 {{subst:commenttest}}
6708 !! result
6709 This template has <!-- a comment --> in it.
6710 !! end
6711
6712 !! test
6713 pre-save transform: unclosed tag
6714 !! options
6715 pst noxml
6716 !! input
6717 <nowiki>'''not wiki'''
6718 !! result
6719 <nowiki>'''not wiki'''
6720 !! end
6721
6722 !! test
6723 pre-save transform: mixed tag case
6724 !! options
6725 pst noxml
6726 !! input
6727 <NOwiki>'''not wiki'''</noWIKI>
6728 !! result
6729 <NOwiki>'''not wiki'''</noWIKI>
6730 !! end
6731
6732 !! test
6733 pre-save transform: unclosed comment in <nowiki>
6734 !! options
6735 pst noxml
6736 !! input
6737 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6738 !! result
6739 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6740 !!end
6741
6742 !! article
6743 Template:dangerous
6744 !!text
6745 <span onmouseover="alert('crap')">Oh no</span>
6746 !!endarticle
6747
6748 !!test
6749 (confirming safety of fix for subst bug 1936)
6750 !! input
6751 {{Template:dangerous}}
6752 !! result
6753 <p><span>Oh no</span>
6754 </p>
6755 !! end
6756
6757 !! test
6758 pre-save transform: comment containing gallery (bug 5024)
6759 !! options
6760 pst
6761 !! input
6762 <!-- <gallery>data</gallery> -->
6763 !!result
6764 <!-- <gallery>data</gallery> -->
6765 !!end
6766
6767 !! test
6768 pre-save transform: comment containing extension
6769 !! options
6770 pst
6771 !! input
6772 <!-- <tag>data</tag> -->
6773 !!result
6774 <!-- <tag>data</tag> -->
6775 !!end
6776
6777 !! test
6778 pre-save transform: comment containing nowiki
6779 !! options
6780 pst
6781 !! input
6782 <!-- <nowiki>data</nowiki> -->
6783 !!result
6784 <!-- <nowiki>data</nowiki> -->
6785 !!end
6786
6787 !! test
6788 pre-save transform: <noinclude> in subst (bug 3298)
6789 !! options
6790 pst
6791 !! input
6792 {{subst:Includes}}
6793 !! result
6794 Foobar
6795 !! end
6796
6797 !! test
6798 pre-save transform: <onlyinclude> in subst (bug 3298)
6799 !! options
6800 pst
6801 !! input
6802 {{subst:Includes2}}
6803 !! result
6804 Foo
6805 !! end
6806
6807 !! article
6808 Template:SubstTest
6809 !!text
6810 {{<includeonly>subst:</includeonly>Includes}}
6811 !! endarticle
6812
6813 !! article
6814 Template:SafeSubstTest
6815 !! text
6816 {{<includeonly>safesubst:</includeonly>Includes}}
6817 !! endarticle
6818
6819 !! test
6820 bug 22297: safesubst: works during PST
6821 !! options
6822 pst
6823 !! input
6824 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6825 !! result
6826 FoobarFoobar
6827 !! end
6828
6829 !! test
6830 bug 22297: safesubst: works during normal parse
6831 !! input
6832 {{SafeSubstTest}}
6833 !! result
6834 <p>Foobar
6835 </p>
6836 !! end
6837
6838 !! test:
6839 subst: does not work during normal parse
6840 !! input
6841 {{SubstTest}}
6842 !! result
6843 <p>{{subst:Includes}}
6844 </p>
6845 !! end
6846
6847 !! test
6848 pre-save transform: context links ("pipe trick")
6849 !! options
6850 pst
6851 !! input
6852 [[Article (context)|]]
6853 [[Bar:Article|]]
6854 [[:Bar:Article|]]
6855 [[Bar:Article (context)|]]
6856 [[:Bar:Article (context)|]]
6857 [[|Article]]
6858 [[|Article (context)]]
6859 [[Bar:X (Y) Z|]]
6860 [[:Bar:X (Y) Z|]]
6861 !! result
6862 [[Article (context)|Article]]
6863 [[Bar:Article|Article]]
6864 [[:Bar:Article|Article]]
6865 [[Bar:Article (context)|Article]]
6866 [[:Bar:Article (context)|Article]]
6867 [[Article]]
6868 [[Article (context)]]
6869 [[Bar:X (Y) Z|X (Y) Z]]
6870 [[:Bar:X (Y) Z|X (Y) Z]]
6871 !! end
6872
6873 !! test
6874 pre-save transform: context links ("pipe trick") with interwiki prefix
6875 !! options
6876 pst
6877 !! input
6878 [[interwiki:Article|]]
6879 [[:interwiki:Article|]]
6880 [[interwiki:Bar:Article|]]
6881 [[:interwiki:Bar:Article|]]
6882 !! result
6883 [[interwiki:Article|Article]]
6884 [[:interwiki:Article|Article]]
6885 [[interwiki:Bar:Article|Bar:Article]]
6886 [[:interwiki:Bar:Article|Bar:Article]]
6887 !! end
6888
6889 !! test
6890 pre-save transform: context links ("pipe trick") with parens in title
6891 !! options
6892 pst title=[[Somearticle (context)]]
6893 !! input
6894 [[|Article]]
6895 !! result
6896 [[Article (context)|Article]]
6897 !! end
6898
6899 !! test
6900 pre-save transform: context links ("pipe trick") with comma in title
6901 !! options
6902 pst title=[[Someplace, Somewhere]]
6903 !! input
6904 [[|Otherplace]]
6905 [[Otherplace, Elsewhere|]]
6906 [[Otherplace, Elsewhere, Anywhere|]]
6907 !! result
6908 [[Otherplace, Somewhere|Otherplace]]
6909 [[Otherplace, Elsewhere|Otherplace]]
6910 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6911 !! end
6912
6913 !! test
6914 pre-save transform: context links ("pipe trick") with parens and comma
6915 !! options
6916 pst title=[[Someplace (IGNORED), Somewhere]]
6917 !! input
6918 [[|Otherplace]]
6919 [[Otherplace (place), Elsewhere|]]
6920 !! result
6921 [[Otherplace, Somewhere|Otherplace]]
6922 [[Otherplace (place), Elsewhere|Otherplace]]
6923 !! end
6924
6925 !! test
6926 pre-save transform: context links ("pipe trick") with comma and parens
6927 !! options
6928 pst title=[[Who, me? (context)]]
6929 !! input
6930 [[|Yes, you.]]
6931 [[Me, Myself, and I (1937 song)|]]
6932 !! result
6933 [[Yes, you. (context)|Yes, you.]]
6934 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6935 !! end
6936
6937 !! test
6938 pre-save transform: context links ("pipe trick") with namespace
6939 !! options
6940 pst title=[[Ns:Somearticle]]
6941 !! input
6942 [[|Article]]
6943 !! result
6944 [[Ns:Article|Article]]
6945 !! end
6946
6947 !! test
6948 pre-save transform: context links ("pipe trick") with namespace and parens
6949 !! options
6950 pst title=[[Ns:Somearticle (context)]]
6951 !! input
6952 [[|Article]]
6953 !! result
6954 [[Ns:Article (context)|Article]]
6955 !! end
6956
6957 !! test
6958 pre-save transform: context links ("pipe trick") with namespace and comma
6959 !! options
6960 pst title=[[Ns:Somearticle, Context, Whatever]]
6961 !! input
6962 [[|Article]]
6963 !! result
6964 [[Ns:Article, Context, Whatever|Article]]
6965 !! end
6966
6967 !! test
6968 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6969 !! options
6970 pst title=[[Ns:Somearticle, Context (context)]]
6971 !! input
6972 [[|Article]]
6973 !! result
6974 [[Ns:Article (context)|Article]]
6975 !! end
6976
6977 !! test
6978 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6979 !! options
6980 pst title=[[Ns:Somearticle (IGNORED), Context]]
6981 !! input
6982 [[|Article]]
6983 !! result
6984 [[Ns:Article, Context|Article]]
6985 !! end
6986
6987 !! test
6988 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6989 !! options
6990 pst
6991 !! input
6992 [[Article(context)|]]
6993 [[Bar:Article(context)|]]
6994 [[:Bar:Article(context)|]]
6995 [[|Article(context)]]
6996 [[Bar:X(Y)Z|]]
6997 [[:Bar:X(Y)Z|]]
6998 !! result
6999 [[Article(context)|Article]]
7000 [[Bar:Article(context)|Article]]
7001 [[:Bar:Article(context)|Article]]
7002 [[Article(context)]]
7003 [[Bar:X(Y)Z|X(Y)Z]]
7004 [[:Bar:X(Y)Z|X(Y)Z]]
7005 !! end
7006
7007 !! test
7008 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7009 !! options
7010 pst
7011 !! input
7012 [[Article (context)|]]
7013 [[Bar:Article (context)|]]
7014 [[:Bar:Article (context)|]]
7015 [[|Article (context)]]
7016 [[Bar:X (Y) Z|]]
7017 [[:Bar:X (Y) Z|]]
7018 !! result
7019 [[Article (context)|Article]]
7020 [[Bar:Article (context)|Article]]
7021 [[:Bar:Article (context)|Article]]
7022 [[Article (context)]]
7023 [[Bar:X (Y) Z|X (Y) Z]]
7024 [[:Bar:X (Y) Z|X (Y) Z]]
7025 !! end
7026
7027 !! test
7028 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7029 !! options
7030 pst
7031 !! input
7032 [[Article(context)|]]
7033 [[Bar:Article(context)|]]
7034 [[:Bar:Article(context)|]]
7035 [[|Article(context)]]
7036 [[Bar:X(Y)Z|]]
7037 [[:Bar:X(Y)Z|]]
7038 !! result
7039 [[Article(context)|Article]]
7040 [[Bar:Article(context)|Article]]
7041 [[:Bar:Article(context)|Article]]
7042 [[Article(context)]]
7043 [[Bar:X(Y)Z|X(Y)Z]]
7044 [[:Bar:X(Y)Z|X(Y)Z]]
7045 !! end
7046
7047 !! test
7048 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7049 !! options
7050 pst
7051 !! input
7052 [[Article (context), context|]]
7053 [[Article (context),context|]]
7054 [[Bar:Article (context), context|]]
7055 [[Bar:Article (context),context|]]
7056 [[:Bar:Article (context), context|]]
7057 [[:Bar:Article (context),context|]]
7058 !! result
7059 [[Article (context), context|Article]]
7060 [[Article (context),context|Article]]
7061 [[Bar:Article (context), context|Article]]
7062 [[Bar:Article (context),context|Article]]
7063 [[:Bar:Article (context), context|Article]]
7064 [[:Bar:Article (context),context|Article]]
7065 !! end
7066
7067 !! test
7068 pre-save transform: trim trailing empty lines
7069 !! options
7070 pst
7071 !! input
7072 Empty lines are trimmed
7073
7074
7075
7076
7077 !! result
7078 Empty lines are trimmed
7079 !! end
7080
7081 !! test
7082 pre-save transform: Signature expansion
7083 !! options
7084 pst
7085 !! input
7086 * ~~~
7087 * <noinclude>~~~</noinclude>
7088 * <includeonly>~~~</includeonly>
7089 * <onlyinclude>~~~</onlyinclude>
7090 !! result
7091 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7092 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7093 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7094 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7095 !! end
7096
7097
7098 !! test
7099 pre-save transform: Signature expansion in nowiki tags (bug 93)
7100 !! options
7101 pst disabled
7102 !! input
7103 Shall not expand:
7104
7105 <nowiki>~~~~</nowiki>
7106
7107 <includeonly><nowiki>~~~~</nowiki></includeonly>
7108
7109 <noinclude><nowiki>~~~~</nowiki></noinclude>
7110
7111 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7112
7113 {{subst:Foo}} shall be converted to FOO
7114
7115 As well as inside noinclude/onlyinclude
7116 <noinclude>{{subst:Foo}}</noinclude>
7117 <onlyinclude>{{subst:Foo}}</onlyinclude>
7118
7119 But not inside includeonly
7120 <includeonly>{{subst:Foo}}</includeonly>
7121 !! result
7122 Shall not expand:
7123
7124 <nowiki>~~~~</nowiki>
7125
7126 <includeonly><nowiki>~~~~</nowiki></includeonly>
7127
7128 <noinclude><nowiki>~~~~</nowiki></noinclude>
7129
7130 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7131
7132 FOO shall be converted to FOO
7133
7134 As well as inside noinclude/onlyinclude
7135 <noinclude>FOO</noinclude>
7136 <onlyinclude>FOO</onlyinclude>
7137
7138 But not inside includeonly
7139 <includeonly>{{subst:Foo}}</includeonly>
7140 !! end
7141
7142 ###
7143 ### Message transform tests
7144 ###
7145 !! test
7146 message transform: magic variables
7147 !! options
7148 msg
7149 !! input
7150 {{SITENAME}}
7151 !! result
7152 MediaWiki
7153 !! end
7154
7155 !! test
7156 message transform: should not transform wiki markup
7157 !! options
7158 msg
7159 !! input
7160 ''test''
7161 !! result
7162 ''test''
7163 !! end
7164
7165 !! test
7166 message transform: <noinclude> in transcluded template (bug 4926)
7167 !! options
7168 msg
7169 !! input
7170 {{Includes}}
7171 !! result
7172 Foobar
7173 !! end
7174
7175 !! test
7176 message transform: <onlyinclude> in transcluded template (bug 4926)
7177 !! options
7178 msg
7179 !! input
7180 {{Includes2}}
7181 !! result
7182 Foo
7183 !! end
7184
7185 !! test
7186 {{#special:}} page name, known
7187 !! options
7188 msg
7189 !! input
7190 {{#special:Recentchanges}}
7191 !! result
7192 Special:RecentChanges
7193 !! end
7194
7195 !! test
7196 {{#special:}} page name with subpage, known
7197 !! options
7198 msg
7199 !! input
7200 {{#special:Recentchanges/param}}
7201 !! result
7202 Special:RecentChanges/param
7203 !! end
7204
7205 !! test
7206 {{#special:}} page name, unknown
7207 !! options
7208 msg
7209 !! input
7210 {{#special:foobarnonexistent}}
7211 !! result
7212 No such special page
7213 !! end
7214
7215 !! test
7216 {{#speciale:}} page name, known
7217 !! options
7218 msg
7219 !! input
7220 {{#speciale:Recentchanges}}
7221 !! result
7222 Special:RecentChanges
7223 !! end
7224
7225 !! test
7226 {{#speciale:}} page name with subpage, known
7227 !! options
7228 msg
7229 !! input
7230 {{#speciale:Recentchanges/param}}
7231 !! result
7232 Special:RecentChanges/param
7233 !! end
7234
7235 !! test
7236 {{#speciale:}} page name, unknown
7237 !! options
7238 msg
7239 !! input
7240 {{#speciale:foobarnonexistent}}
7241 !! result
7242 No_such_special_page
7243 !! end
7244
7245 ###
7246 ### Images
7247 ###
7248 !! test
7249 Simple image
7250 !! input
7251 [[Image:foobar.jpg]]
7252 !! result
7253 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7254 </p>
7255 !! end
7256
7257 !! test
7258 Right-aligned image
7259 !! input
7260 [[Image:foobar.jpg|right]]
7261 !! result
7262 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7263
7264 !! end
7265
7266 !! test
7267 Simple image (using File: namespace, now canonical)
7268 !! input
7269 [[File:foobar.jpg]]
7270 !! result
7271 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7272 </p>
7273 !! end
7274
7275 !! test
7276 Image with caption
7277 !! input
7278 [[Image:foobar.jpg|right|Caption text]]
7279 !! result
7280 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7281
7282 !! end
7283
7284 !! test
7285 Image with empty attribute
7286 !! input
7287 [[Image:foobar.jpg|right||Caption text]]
7288 !! result
7289 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7290
7291 !! end
7292
7293 !! test
7294 Image with link tails
7295 !! input
7296 123[[Image:foobar.jpg]]456
7297 123[[Image:foobar.jpg|right]]456
7298 123[[Image:foobar.jpg|thumb]]456
7299 !! result
7300 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
7301 </p>
7302 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
7303 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
7304
7305 !! end
7306
7307 !! test
7308 Image with multiple captions -- only last one is accepted
7309 !! input
7310 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7311 !! result
7312 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7313
7314 !! end
7315
7316 !! test
7317 Image with width attribute at different positions
7318 !! input
7319 [[Image:foobar.jpg|200px|right|Caption]]
7320 [[Image:foobar.jpg|right|200px|Caption]]
7321 [[Image:foobar.jpg|right|Caption|200px]]
7322 !! result
7323 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7324 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7325 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7326
7327 !! end
7328
7329 !! test
7330 Image with link parameter, wiki target
7331 !! input
7332 [[Image:foobar.jpg|link=Target page]]
7333 !! result
7334 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7335 </p>
7336 !! end
7337
7338 !! test
7339 Image with link parameter, URL target
7340 !! input
7341 [[Image:foobar.jpg|link=http://example.com/]]
7342 !! result
7343 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7344 </p>
7345 !! end
7346
7347 !! test
7348 Image with link parameter, wgExternalLinkTarget
7349 !! input
7350 [[Image:foobar.jpg|link=http://example.com/]]
7351 !! config
7352 wgExternalLinkTarget='foobar'
7353 !! result
7354 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7355 </p>
7356 !! end
7357
7358 !! test
7359 Image with link parameter, wgNoFollowLinks set to false
7360 !! input
7361 [[Image:foobar.jpg|link=http://example.com/]]
7362 !! config
7363 wgNoFollowLinks=false
7364 !! result
7365 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7366 </p>
7367 !! end
7368
7369 !! test
7370 Image with link parameter, wgNoFollowDomainExceptions
7371 !! input
7372 [[Image:foobar.jpg|link=http://example.com/]]
7373 !! config
7374 wgNoFollowDomainExceptions='example.com'
7375 !! result
7376 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7377 </p>
7378 !! end
7379
7380 !! test
7381 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7382 !! input
7383 [[Image:foobar.jpg|link=http://example.com/|Title]]
7384 !! config
7385 wgExternalLinkTarget='foobar'
7386 !! result
7387 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7388 </p>
7389 !! end
7390
7391 !! test
7392 Image with empty link parameter
7393 !! input
7394 [[Image:foobar.jpg|link=]]
7395 !! result
7396 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7397 </p>
7398 !! end
7399
7400 !! test
7401 Image with link parameter (wiki target) and unnamed parameter
7402 !! input
7403 [[Image:foobar.jpg|link=Target page|Title]]
7404 !! result
7405 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7406 </p>
7407 !! end
7408
7409 !! test
7410 Image with link parameter (URL target) and unnamed parameter
7411 !! input
7412 [[Image:foobar.jpg|link=http://example.com/|Title]]
7413 !! result
7414 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7415 </p>
7416 !! end
7417
7418 !! test
7419 Thumbnail image with link parameter
7420 !! options
7421 php
7422 !! input
7423 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7424 !! result
7425 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7426
7427 !! end
7428
7429 !! test
7430 Manually-specified thumbnail image
7431 !! options
7432 php
7433 !! input
7434 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7435 !! result
7436 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7437
7438 !! end
7439
7440 !! test
7441 Manually-specified thumbnail image with explicit link to wiki page
7442 !! options
7443 php
7444 !! input
7445 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7446 !! result
7447 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7448
7449 !! end
7450
7451 !! test
7452 Manually-specified thumbnail image with explicit link to url
7453 !! options
7454 php
7455 !! input
7456 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7457 !! result
7458 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7459
7460 !! end
7461
7462 !! test
7463 Manually-specified thumbnail image with explicit no link
7464 !! options
7465 php
7466 !! input
7467 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7468 !! result
7469 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7470
7471 !! end
7472
7473 !! test
7474 Manually-specified thumbnail image with explicit link and alt text
7475 !! options
7476 php
7477 !! input
7478 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7479 !! result
7480 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7481
7482 !! end
7483
7484 !! test
7485 Image with frame and link
7486 !! input
7487 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7488 !! result
7489 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7490
7491 !! end
7492
7493 !! test
7494 Image with frame and link and explicit alt
7495 !! input
7496 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7497 !! result
7498 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7499
7500 !! end
7501
7502 !! test
7503 Image with wiki markup in implicit alt
7504 !! input
7505 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7506 !! result
7507 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7508 </p>
7509 !! end
7510
7511 !! test
7512 Image with wiki markup in explicit alt
7513 !! input
7514 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7515 !! result
7516 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7517 </p>
7518 !! end
7519
7520 !! test
7521 Link to image page- image page normally doesn't exists, hence edit link
7522 Add test with existing image page
7523 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7524 !! input
7525 [[:Image:test]]
7526 !! result
7527 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
7528 </p>
7529 !! end
7530
7531 !! test
7532 bug 18784 Link to non-existent image page with caption should use caption as link text
7533 !! input
7534 [[:Image:test|caption]]
7535 !! result
7536 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
7537 </p>
7538 !! end
7539
7540 !! test
7541 Frameless image caption with a free URL
7542 !! input
7543 [[Image:foobar.jpg|http://example.com]]
7544 !! result
7545 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7546 </p>
7547 !! end
7548
7549 !! test
7550 Thumbnail image caption with a free URL
7551 !! input
7552 [[Image:foobar.jpg|thumb|http://example.com]]
7553 !! result
7554 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7555
7556 !! end
7557
7558 !! test
7559 Thumbnail image caption with a free URL and explicit alt
7560 !! input
7561 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7562 !! result
7563 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7564
7565 !! end
7566
7567 !! test
7568 BUG 1887: A ISBN with a thumbnail
7569 !! input
7570 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7571 !! result
7572 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
7573
7574 !! end
7575
7576 !! test
7577 BUG 1887: A RFC with a thumbnail
7578 !! input
7579 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7580 !! result
7581 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7582
7583 !! end
7584
7585 !! test
7586 BUG 1887: A mailto link with a thumbnail
7587 !! input
7588 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7589 !! result
7590 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
7591
7592 !! end
7593
7594 # Pending resolution to bug 368
7595 !! test
7596 BUG 648: Frameless image caption with a link
7597 !! input
7598 [[Image:foobar.jpg|text with a [[link]] in it]]
7599 !! result
7600 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7601 </p>
7602 !! end
7603
7604 !! test
7605 BUG 648: Frameless image caption with a link (suffix)
7606 !! input
7607 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7608 !! result
7609 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7610 </p>
7611 !! end
7612
7613 !! test
7614 BUG 648: Frameless image caption with an interwiki link
7615 !! input
7616 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7617 !! result
7618 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7619 </p>
7620 !! end
7621
7622 !! test
7623 BUG 648: Frameless image caption with a piped interwiki link
7624 !! input
7625 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7626 !! result
7627 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7628 </p>
7629 !! end
7630
7631 !! test
7632 Escape HTML special chars in image alt text
7633 !! input
7634 [[Image:foobar.jpg|& < > "]]
7635 !! result
7636 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7637 </p>
7638 !! end
7639
7640 !! test
7641 BUG 499: Alt text should have &#1234;, not &amp;1234;
7642 !! input
7643 [[Image:foobar.jpg|&#9792;]]
7644 !! result
7645 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7646 </p>
7647 !! end
7648
7649 !! test
7650 Broken image caption with link
7651 !! input
7652 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7653 !! result
7654 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
7655 </p>
7656 !! end
7657
7658 !! test
7659 Image caption containing another image
7660 !! input
7661 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7662 !! result
7663 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
7664
7665 !! end
7666
7667 !! test
7668 Image caption containing a newline
7669 !! input
7670 [[Image:Foobar.jpg|This
7671 *is some text]]
7672 !! result
7673 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7674 </p>
7675 !!end
7676
7677 !!test
7678 Parsoid: Image caption containing leading space
7679 (The leading space should not trigger nowiki escaping in wt2wt mode)
7680 !! input
7681 [[Image:Foobar.jpg|thumb| bar]]
7682 !! result
7683 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
7684
7685 !!end
7686
7687 !! test
7688 Bug 3090: External links other than http: in image captions
7689 !! input
7690 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7691 !! result
7692 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
7693
7694 !! end
7695
7696 !! test
7697 Custom class
7698 !! input
7699 [[Image:foobar.jpg|a|class=b]]
7700 !! result
7701 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
7702 </p>
7703 !! end
7704
7705 !! test
7706 Localized image handling (1).
7707 !! options
7708 language=es
7709 !! input
7710 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7711 !! result
7712 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7713
7714 !! end
7715
7716 !! test
7717 Localized image handling (2).
7718 !! options
7719 language=es
7720 !! input
7721 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7722 !! result
7723 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7724
7725 !! end
7726
7727 !! test
7728 "border", "frameless" and "class" attributes on an image.
7729 !! input
7730 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7731 !! result
7732 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
7733 </p>
7734 !! end
7735
7736 !! article
7737 File:Barfoo.jpg
7738 !! text
7739 #REDIRECT [[File:Barfoo.jpg]]
7740 !! endarticle
7741
7742 !! test
7743 Redirected image
7744 !! input
7745 [[Image:Barfoo.jpg]]
7746 !! result
7747 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7748 </p>
7749 !! end
7750
7751 !! test
7752 Missing image with uploads disabled
7753 !! options
7754 wgEnableUploads=0
7755 !! input
7756 [[Image:Foobaz.jpg]]
7757 !! result
7758 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7759 </p>
7760 !! end
7761
7762
7763 ###
7764 ### Subpages
7765 ###
7766 !! article
7767 Subpage test/subpage
7768 !! text
7769 foo
7770 !! endarticle
7771
7772 !! test
7773 Subpage link
7774 !! options
7775 subpage title=[[Subpage test]]
7776 !! input
7777 [[/subpage]]
7778 !! result
7779 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7780 </p>
7781 !! end
7782
7783 !! test
7784 Subpage noslash link
7785 !! options
7786 subpage title=[[Subpage test]]
7787 !!input
7788 [[/subpage/]]
7789 !! result
7790 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7791 </p>
7792 !! end
7793
7794 !! test
7795 Disabled subpages
7796 !! input
7797 [[/subpage]]
7798 !! result
7799 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7800 </p>
7801 !! end
7802
7803 !! test
7804 BUG 561: {{/Subpage}}
7805 !! options
7806 subpage title=[[Page]]
7807 !! input
7808 {{/Subpage}}
7809 !! result
7810 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
7811 </p>
7812 !! end
7813
7814 ###
7815 ### Categories
7816 ###
7817 !! article
7818 Category:MediaWiki User's Guide
7819 !! text
7820 blah
7821 !! endarticle
7822
7823 !! test
7824 Link to category
7825 !! input
7826 [[:Category:MediaWiki User's Guide]]
7827 !! result
7828 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7829 </p>
7830 !! end
7831
7832 !! test
7833 Simple category
7834 !! options
7835 cat
7836 !! input
7837 [[Category:MediaWiki User's Guide]]
7838 !! result
7839 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7840 !! end
7841
7842 !! test
7843 PAGESINCATEGORY invalid title fatal (r33546 fix)
7844 !! input
7845 {{PAGESINCATEGORY:<bogus>}}
7846 !! result
7847 <p>0
7848 </p>
7849 !! end
7850
7851 !! test
7852 Category with different sort key
7853 !! options
7854 cat
7855 !! input
7856 [[Category:MediaWiki User's Guide|Foo]]
7857 !! result
7858 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7859 !! end
7860
7861 !! test
7862 Category with identical sort key
7863 !! options
7864 cat
7865 !! input
7866 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7867 !! result
7868 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7869 !! end
7870
7871 !! test
7872 Category with empty sort key
7873 !! options
7874 cat
7875 pst
7876 !! input
7877 [[Category:MediaWiki User's Guide|]]
7878 !! result
7879 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7880 !! end
7881
7882 !! test
7883 Category with empty sort key and parentheses
7884 !! options
7885 cat
7886 pst
7887 !! input
7888 [[Category:Foo (bar)|]]
7889 !! result
7890 [[Category:Foo (bar)|Foo]]
7891 !! end
7892
7893 !! test
7894 Category with link tail
7895 !! options
7896 cat
7897 pst
7898 !! input
7899 123[[Category:Foo]]456
7900 !! result
7901 123[[Category:Foo]]456
7902 !! end
7903
7904 !! test
7905 Category with template
7906 !! options
7907 cat
7908 pst
7909 !! input
7910 [[Category:{{echo|Foo}}]]
7911 !! result
7912 [[Category:{{echo|Foo}}]]
7913 !! end
7914
7915 !! test
7916 Category with template in sort key
7917 !! options
7918 cat
7919 pst
7920 !! input
7921 [[Category:Foo|{{echo|Bar}}]]
7922 !! result
7923 [[Category:Foo|{{echo|Bar}}]]
7924 !! end
7925
7926 !! test
7927 Category with template in sort key and title
7928 !! options
7929 cat
7930 pst
7931 !! input
7932 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7933 !! result
7934 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7935 !! end
7936
7937 !! test
7938 Category / paragraph interactions
7939 !! input
7940 Foo [[Category:Baz]] Bar
7941
7942 Foo [[Category:Baz]]
7943 Bar
7944
7945 Foo
7946 [[Category:Baz]]
7947 Bar
7948
7949 Foo
7950 [[Category:Baz]] Bar
7951
7952 Foo
7953 [[Category:Baz]]
7954 [[Category:Baz]]
7955 [[Category:Baz]]
7956 Bar
7957
7958 [[Category:Baz]]
7959 [[Category:Baz]]
7960 [[Category:Baz]]
7961
7962 [[Category:Baz]]
7963 {{echo|[[Category:Baz]]}}
7964 [[Category:Baz]]
7965 !! result
7966 <p>Foo Bar
7967 </p><p>Foo
7968 Bar
7969 </p><p>Foo
7970 Bar
7971 </p><p>Foo Bar
7972 </p><p>Foo
7973 Bar
7974 </p>
7975 !! end
7976
7977 ###
7978 ### Inter-language links
7979 ###
7980 !! test
7981 Inter-language links
7982 !! options
7983 ill
7984 !! input
7985 [[es:Alimento]]
7986 [[fr:Nourriture]]
7987 [[zh:&#39135;&#21697;]]
7988 !! result
7989 es:Alimento fr:Nourriture zh:食品
7990 !! end
7991
7992 !! test
7993 Duplicate interlanguage links (bug 24502)
7994 !! options
7995 ill
7996 !! input
7997 [[es:1]]
7998 [[es:2]]
7999 [[fr:1]]
8000 [[fr:2]]
8001 !! result
8002 es:1 fr:1
8003 !! end
8004
8005 ###
8006 ### Sections
8007 ###
8008 !! test
8009 Basic section headings
8010 !! input
8011 == Headline 1 ==
8012 Some text
8013
8014 ==Headline 2==
8015 More
8016 ===Smaller headline===
8017 Blah blah
8018 !! result
8019 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1">Headline 1</span></h2>
8020 <p>Some text
8021 </p>
8022 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
8023 <p>More
8024 </p>
8025 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline" id="Smaller_headline">Smaller headline</span></h3>
8026 <p>Blah blah
8027 </p>
8028 !! end
8029
8030 !! test
8031 Section headings with TOC
8032 !! input
8033 == Headline 1 ==
8034 === Subheadline 1 ===
8035 ===== Skipping a level =====
8036 ====== Skipping a level ======
8037
8038 == Headline 2 ==
8039 Some text
8040 ===Another headline===
8041 !! result
8042 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8043 <ul>
8044 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8045 <ul>
8046 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8047 <ul>
8048 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
8049 <ul>
8050 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
8051 </ul>
8052 </li>
8053 </ul>
8054 </li>
8055 </ul>
8056 </li>
8057 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8058 <ul>
8059 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8060 </ul>
8061 </li>
8062 </ul>
8063 </td></tr></table>
8064 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1">Headline 1</span></h2>
8065 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline" id="Subheadline_1">Subheadline 1</span></h3>
8066 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level">Skipping a level</span></h5>
8067 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span></h6>
8068 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
8069 <p>Some text
8070 </p>
8071 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline" id="Another_headline">Another headline</span></h3>
8072
8073 !! end
8074
8075 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8076 !! test
8077 Handling of sections up to level 6 and beyond
8078 !! input
8079 = Level 1 Heading=
8080 == Level 2 Heading==
8081 === Level 3 Heading===
8082 ==== Level 4 Heading====
8083 ===== Level 5 Heading=====
8084 ====== Level 6 Heading======
8085 ======= Level 7 Heading=======
8086 ======== Level 8 Heading========
8087 ========= Level 9 Heading=========
8088 ========== Level 10 Heading==========
8089 !! result
8090 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8091 <ul>
8092 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8093 <ul>
8094 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
8095 <ul>
8096 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
8097 <ul>
8098 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
8099 <ul>
8100 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
8101 <ul>
8102 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
8103 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
8104 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
8105 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
8106 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
8107 </ul>
8108 </li>
8109 </ul>
8110 </li>
8111 </ul>
8112 </li>
8113 </ul>
8114 </li>
8115 </ul>
8116 </li>
8117 </ul>
8118 </td></tr></table>
8119 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span></h1>
8120 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span></h2>
8121 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span></h3>
8122 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span></h4>
8123 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span></h5>
8124 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span></h6>
8125 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span></h6>
8126 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span></h6>
8127 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span></h6>
8128 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span></h6>
8129
8130 !! end
8131
8132 !! test
8133 TOC regression (bug 9764)
8134 !! input
8135 == title 1 ==
8136 === title 1.1 ===
8137 ==== title 1.1.1 ====
8138 === title 1.2 ===
8139 == title 2 ==
8140 === title 2.1 ===
8141 !! result
8142 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8143 <ul>
8144 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8145 <ul>
8146 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
8147 <ul>
8148 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
8149 </ul>
8150 </li>
8151 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8152 </ul>
8153 </li>
8154 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8155 <ul>
8156 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8157 </ul>
8158 </li>
8159 </ul>
8160 </td></tr></table>
8161 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1">title 1</span></h2>
8162 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1">title 1.1</span></h3>
8163 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1">title 1.1.1</span></h4>
8164 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2">title 1.2</span></h3>
8165 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2">title 2</span></h2>
8166 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1">title 2.1</span></h3>
8167
8168 !! end
8169
8170 !! test
8171 TOC with wgMaxTocLevel=3 (bug 6204)
8172 !! options
8173 wgMaxTocLevel=3
8174 !! input
8175 == title 1 ==
8176 === title 1.1 ===
8177 ==== title 1.1.1 ====
8178 === title 1.2 ===
8179 == title 2 ==
8180 === title 2.1 ===
8181 !! result
8182 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8183 <ul>
8184 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8185 <ul>
8186 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8187 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8188 </ul>
8189 </li>
8190 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8191 <ul>
8192 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8193 </ul>
8194 </li>
8195 </ul>
8196 </td></tr></table>
8197 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1">title 1</span></h2>
8198 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1">title 1.1</span></h3>
8199 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1">title 1.1.1</span></h4>
8200 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2">title 1.2</span></h3>
8201 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2">title 2</span></h2>
8202 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1">title 2.1</span></h3>
8203
8204 !! end
8205
8206 !! test
8207 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8208 !! options
8209 wgMaxTocLevel=3
8210 !! input
8211 ==Section 1==
8212 ===Section 1.1===
8213 ====Section 1.1.1====
8214 ====Section 1.1.1.1====
8215 ==Section 2==
8216 !! result
8217 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8218 <ul>
8219 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8220 <ul>
8221 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
8222 </ul>
8223 </li>
8224 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8225 </ul>
8226 </td></tr></table>
8227 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
8228 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1">Section 1.1</span></h3>
8229 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span></h4>
8230 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span></h4>
8231 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8232
8233 !! end
8234
8235
8236 !! test
8237 Resolving duplicate section names
8238 !! input
8239 == Foo bar ==
8240 == Foo bar ==
8241 !! result
8242 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar">Foo bar</span></h2>
8243 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar_2">Foo bar</span></h2>
8244
8245 !! end
8246
8247 !! test
8248 Resolving duplicate section names with differing case (bug 10721)
8249 !! input
8250 == Foo bar ==
8251 == Foo Bar ==
8252 !! result
8253 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar">Foo bar</span></h2>
8254 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2">Foo Bar</span></h2>
8255
8256 !! end
8257
8258 !! article
8259 Template:sections
8260 !! text
8261 ===Section 1===
8262 ==Section 2==
8263 !! endarticle
8264
8265 !! test
8266 Template with sections, __NOTOC__
8267 !! input
8268 __NOTOC__
8269 ==Section 0==
8270 {{sections}}
8271 ==Section 4==
8272 !! result
8273 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline" id="Section_0">Section 0</span></h2>
8274 <h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h3>
8275 <h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8276 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline" id="Section_4">Section 4</span></h2>
8277
8278 !! end
8279
8280 !! test
8281 __NOEDITSECTION__ keyword
8282 !! input
8283 __NOEDITSECTION__
8284 ==Section 1==
8285 ==Section 2==
8286 !! result
8287 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
8288 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8289
8290 !! end
8291
8292 !! test
8293 Link inside a section heading
8294 !! input
8295 ==Section with a [[Main Page|link]] in it==
8296 !! result
8297 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span></h2>
8298
8299 !! end
8300
8301 !! test
8302 TOC regression (bug 12077)
8303 !! input
8304 __TOC__
8305 == title 1 ==
8306 === title 1.1 ===
8307 == title 2 ==
8308 !! result
8309 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8310 <ul>
8311 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8312 <ul>
8313 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8314 </ul>
8315 </li>
8316 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8317 </ul>
8318 </td></tr></table>
8319 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1">title 1</span></h2>
8320 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1">title 1.1</span></h3>
8321 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2">title 2</span></h2>
8322
8323 !! end
8324
8325 !! test
8326 BUG 1219 URL next to image (good)
8327 !! input
8328 http://example.com [[Image:foobar.jpg]]
8329 !! result
8330 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8331 </p>
8332 !!end
8333
8334 !! test
8335 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8336 !! input
8337 ===
8338 The line above must have a trailing space!
8339 === <!--
8340 --> <!-- -->
8341 But just in case it doesn't...
8342 !! result
8343 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1>
8344 <p>The line above must have a trailing space!
8345 </p>
8346 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1>
8347 <p>But just in case it doesn't...
8348 </p>
8349 !! end
8350
8351 !! test
8352 Header with special characters (bug 25462)
8353 !! input
8354 The tooltips shall not show entities to the user (ie. be double escaped)
8355
8356 == text > text ==
8357 section 1
8358
8359 == text < text ==
8360 section 2
8361
8362 == text & text ==
8363 section 3
8364
8365 == text ' text ==
8366 section 4
8367
8368 == text " text ==
8369 section 5
8370 !! result
8371 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8372 </p>
8373 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8374 <ul>
8375 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
8376 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
8377 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
8378 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8379 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8380 </ul>
8381 </td></tr></table>
8382 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span> <span class="mw-headline" id="text_.3E_text">text &gt; text</span></h2>
8383 <p>section 1
8384 </p>
8385 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span> <span class="mw-headline" id="text_.3C_text">text &lt; text</span></h2>
8386 <p>section 2
8387 </p>
8388 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span> <span class="mw-headline" id="text_.26_text">text &amp; text</span></h2>
8389 <p>section 3
8390 </p>
8391 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span> <span class="mw-headline" id="text_.27_text">text ' text</span></h2>
8392 <p>section 4
8393 </p>
8394 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span> <span class="mw-headline" id="text_.22_text">text " text</span></h2>
8395 <p>section 5
8396 </p>
8397 !! end
8398
8399 !! test
8400 Headers with excess '=' characters
8401 (Are similar tests necessary beyond the 1st level?)
8402 !! input
8403 =foo==
8404 ==foo=
8405 =''italic'' heading==
8406 ==''italic'' heading=
8407 !! result
8408 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8409 <ul>
8410 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8411 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8412 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
8413 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
8414 </ul>
8415 </td></tr></table>
8416 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span> <span class="mw-headline" id="foo.3D">foo=</span></h1>
8417 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span> <span class="mw-headline" id=".3Dfoo">=foo</span></h1>
8418 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span> <span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span></h1>
8419 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span> <span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span></h1>
8420
8421 !! end
8422
8423 !! test
8424 HTML headers vs TOC (bug 23393)
8425 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8426 !! input
8427 <h1>Header 1</h1>
8428 == Header 1.1 ==
8429 == Header 1.2 ==
8430
8431 <h1>Header 2
8432 </h1>
8433 == Header 2.1 ==
8434 == Header 2.2 ==
8435 __NOEDITSECTION__
8436 !! result
8437 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8438 <ul>
8439 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8440 <ul>
8441 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
8442 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
8443 </ul>
8444 </li>
8445 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8446 <ul>
8447 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
8448 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
8449 </ul>
8450 </li>
8451 </ul>
8452 </td></tr></table>
8453 <h1> <span class="mw-headline" id="Header_1">Header 1</span></h1>
8454 <h2> <span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8455 <h2> <span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8456 <h1> <span class="mw-headline" id="Header_2">Header 2</span></h1>
8457 <h2> <span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8458 <h2> <span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8459
8460 !! end
8461
8462 !! test
8463 BUG 1219 URL next to image (broken)
8464 !! input
8465 http://example.com[[Image:foobar.jpg]]
8466 !! result
8467 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8468 </p>
8469 !!end
8470
8471 !! test
8472 Bug 1186 news: in the middle of text
8473 !! input
8474 http://en.wikinews.org/wiki/Wikinews:Workplace
8475 !! result
8476 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8477 </p>
8478 !!end
8479
8480
8481 !! test
8482 Namespaced link must have a title
8483 !! input
8484 [[Project:]]
8485 !! result
8486 <p>[[Project:]]
8487 </p>
8488 !!end
8489
8490 !! test
8491 Namespaced link must have a title (bad fragment version)
8492 !! input
8493 [[Project:#fragment]]
8494 !! result
8495 <p>[[Project:#fragment]]
8496 </p>
8497 !!end
8498
8499
8500 ###
8501 ### HTML tags and HTML attributes
8502 ###
8503
8504 !! test
8505 div with no attributes
8506 !! input
8507 <div>HTML rocks</div>
8508 !! result
8509 <div>HTML rocks</div>
8510
8511 !! end
8512
8513 !! test
8514 div with double-quoted attribute
8515 !! input
8516 <div id="rock">HTML rocks</div>
8517 !! result
8518 <div id="rock">HTML rocks</div>
8519
8520 !! end
8521
8522 !! test
8523 div with single-quoted attribute
8524 !! input
8525 <div id='rock'>HTML rocks</div>
8526 !! result
8527 <div id="rock">HTML rocks</div>
8528
8529 !! end
8530
8531 !! test
8532 div with unquoted attribute
8533 !! input
8534 <div id=rock>HTML rocks</div>
8535 !! result
8536 <div id="rock">HTML rocks</div>
8537
8538 !! end
8539
8540 !! test
8541 div with illegal double attributes
8542 !! input
8543 <div id="a" id="b">HTML rocks</div>
8544 !! result
8545 <div id="b">HTML rocks</div>
8546
8547 !!end
8548
8549 # FIXME: produce empty string instead of "class" in the PHP parser, following
8550 # the HTML5 spec.
8551 !! test
8552 div with empty attribute value, space before equals
8553 !! options
8554 disabled
8555 !! input
8556 <div class =>HTML rocks</div>
8557 !! result
8558 <div class="">HTML rocks</div>
8559
8560 !! end
8561
8562 # The PHP parser escapes the opening brace to &#123; for some reason, so
8563 # disabled this test for it.
8564 !! test
8565 div with braces in attribute value
8566 !! options
8567 disabled
8568 !! input
8569 <div title="{}">Foo</div>
8570 !! result
8571 <div title="{}">Foo</div>
8572 !! end
8573
8574 # This it very inconsistent in the PHP parser: it returns
8575 # class="class" if there is a space between the name and the equal sign (see
8576 # 'div with empty attribute value, space before equals'), but strips the
8577 # attribute completely if the space is missing. We hope that not much content
8578 # depends on this, so are implementing the behavior below in Parsoid for
8579 # consistencies' sake. Disabled for the PHP parser.
8580 # FIXME: fix this behavior in the PHP parser?
8581 !! test
8582 div with empty attribute value, no space before equals
8583 !! options
8584 disabled
8585 !! input
8586 <div class=>HTML rocks</div>
8587 !! result
8588 <div class="">HTML rocks</div>
8589
8590 !! end
8591
8592 !! test
8593 HTML multiple attributes correction
8594 !! input
8595 <p class="error" class="awesome">Awesome!</p>
8596 !! result
8597 <p class="awesome">Awesome!</p>
8598
8599 !!end
8600
8601 !! test
8602 Table multiple attributes correction
8603 !! input
8604 {|
8605 !+ class="error" class="awesome"| status
8606 |}
8607 !! result
8608 <table>
8609 <tr>
8610 <th class="awesome"> status
8611 </th></tr></table>
8612
8613 !!end
8614
8615 !! test
8616 DIV IN UPPERCASE
8617 !! input
8618 <DIV ID="x">HTML ROCKS</DIV>
8619 !! result
8620 <div id="x">HTML ROCKS</div>
8621
8622 !!end
8623
8624 !! test
8625 Non-ASCII pseudo-tags are rendered as text
8626 !! input
8627 <khyô>
8628 !! result
8629 <p>&lt;khyô&gt;
8630 </p>
8631 !! end
8632
8633 !! test
8634 Pseudo-tag with URL 'name' renders as url link
8635 !! input
8636 <http://example.com/>
8637 !! result
8638 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8639 </p>
8640 !! end
8641
8642 !! test
8643 text with amp in the middle of nowhere
8644 !! input
8645 Remember AT&T?
8646 !!result
8647 <p>Remember AT&amp;T?
8648 </p>
8649 !! end
8650
8651 !! test
8652 text with character entity: eacute
8653 !! input
8654 I always thought &eacute; was a cute letter.
8655 !! result
8656 <p>I always thought &#233; was a cute letter.
8657 </p>
8658 !! end
8659
8660 !! test
8661 text with entity-escaped character entity-like string: eacute
8662 !! input
8663 I always thought &amp;eacute; was a cute letter.
8664 !! result
8665 <p>I always thought &amp;eacute; was a cute letter.
8666 </p>
8667 !! end
8668
8669 !! test
8670 text with undefined character entity: xacute
8671 !! input
8672 I always thought &xacute; was a cute letter.
8673 !! result
8674 <p>I always thought &amp;xacute; was a cute letter.
8675 </p>
8676 !! end
8677
8678
8679 ###
8680 ### Media links
8681 ###
8682
8683 !! test
8684 Media link
8685 !! input
8686 [[Media:Foobar.jpg]]
8687 !! result
8688 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8689 </p>
8690 !! end
8691
8692 !! test
8693 Media link with text
8694 !! input
8695 [[Media:Foobar.jpg|A neat file to look at]]
8696 !! result
8697 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8698 </p>
8699 !! end
8700
8701 # FIXME: this is still bad HTML tag nesting
8702 !! test
8703 Media link with nasty text
8704 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8705 !! input
8706 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8707 !! result
8708 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
8709
8710 !! end
8711
8712 !! test
8713 Media link to nonexistent file (bug 1702)
8714 !! input
8715 [[Media:No such.jpg]]
8716 !! result
8717 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8718 </p>
8719 !! end
8720
8721 !! test
8722 Image link to nonexistent file (bug 1850 - good)
8723 !! input
8724 [[Image:No such.jpg]]
8725 !! result
8726 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
8727 </p>
8728 !! end
8729
8730 !! test
8731 :Image link to nonexistent file (bug 1850 - bad)
8732 !! input
8733 [[:Image:No such.jpg]]
8734 !! result
8735 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
8736 </p>
8737 !! end
8738
8739
8740
8741 !! test
8742 Character reference normalization in link text (bug 1938)
8743 !! input
8744 [[Main Page|this&that]]
8745 !! result
8746 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8747 </p>
8748 !!end
8749
8750 !! article
8751 אַ
8752 !! text
8753 Test for unicode normalization
8754
8755 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8756 !! endarticle
8757
8758 !! test
8759 (bug 19451) Links should refer to the normalized form.
8760 !! input
8761 [[&#xFB2E;]]
8762 [[&#x5d0;&#x5b7;]]
8763 [[&#x5d0;ַ]]
8764 [[א&#x5b7;]]
8765 [[אַ]]
8766 !! result
8767 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8768 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8769 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8770 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8771 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8772 </p>
8773 !! end
8774
8775 !! test
8776 Empty attribute crash test (bug 2067)
8777 !! input
8778 <font color="">foo</font>
8779 !! result
8780 <p><font color="">foo</font>
8781 </p>
8782 !! end
8783
8784 !! test
8785 Empty attribute crash test single-quotes (bug 2067)
8786 !! input
8787 <font color=''>foo</font>
8788 !! result
8789 <p><font color="">foo</font>
8790 </p>
8791 !! end
8792
8793 !! test
8794 Attribute test: equals, then nothing
8795 !! input
8796 <font color=>foo</font>
8797 !! result
8798 <p><font>foo</font>
8799 </p>
8800 !! end
8801
8802 !! test
8803 Attribute test: unquoted value
8804 !! input
8805 <font color=x>foo</font>
8806 !! result
8807 <p><font color="x">foo</font>
8808 </p>
8809 !! end
8810
8811 !! test
8812 Attribute test: unquoted but illegal value (hash)
8813 !! input
8814 <font color=#x>foo</font>
8815 !! result
8816 <p><font color="#x">foo</font>
8817 </p>
8818 !! end
8819
8820 !! test
8821 Attribute test: no value
8822 !! input
8823 <font color>foo</font>
8824 !! result
8825 <p><font color="color">foo</font>
8826 </p>
8827 !! end
8828
8829 !! test
8830 Bug 2095: link with three closing brackets
8831 !! input
8832 [[Main Page]]]
8833 !! result
8834 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8835 </p>
8836 !! end
8837
8838 !! test
8839 Bug 2095: link with pipe and three closing brackets
8840 !! input
8841 [[Main Page|link]]]
8842 !! result
8843 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8844 </p>
8845 !! end
8846
8847 !! test
8848 Bug 2095: link with pipe and three closing brackets, version 2
8849 !! input
8850 [[Main Page|[http://example.com/]]]
8851 !! result
8852 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8853 </p>
8854 !! end
8855
8856
8857 ###
8858 ### Safety
8859 ###
8860
8861 !! article
8862 Template:Dangerous attribute
8863 !! text
8864 " onmouseover="alert(document.cookie)
8865 !! endarticle
8866
8867 !! article
8868 Template:Dangerous style attribute
8869 !! text
8870 border-size: expression(alert(document.cookie))
8871 !! endarticle
8872
8873 !! article
8874 Template:Div style
8875 !! text
8876 <div style="float: right; {{{1}}}">Magic div</div>
8877 !! endarticle
8878
8879 !! test
8880 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8881 !! input
8882 <div title="{{test}}"></div>
8883 !! result
8884 <div title="This is a test template"></div>
8885
8886 !! end
8887
8888 !! test
8889 Bug 2304: HTML attribute safety (dangerous template; 2309)
8890 !! input
8891 <div title="{{dangerous attribute}}"></div>
8892 !! result
8893 <div title=""></div>
8894
8895 !! end
8896
8897 !! test
8898 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8899 !! input
8900 <div style="{{dangerous style attribute}}"></div>
8901 !! result
8902 <div style="/* insecure input */"></div>
8903
8904 !! end
8905
8906 !! test
8907 Bug 2304: HTML attribute safety (safe parameter; 2309)
8908 !! input
8909 {{div style|width: 200px}}
8910 !! result
8911 <div style="float: right; width: 200px">Magic div</div>
8912
8913 !! end
8914
8915 !! test
8916 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8917 !! input
8918 {{div style|width: expression(alert(document.cookie))}}
8919 !! result
8920 <div style="/* insecure input */">Magic div</div>
8921
8922 !! end
8923
8924 !! test
8925 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8926 !! input
8927 {{div style|"><script>alert(document.cookie)</script>}}
8928 !! result
8929 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8930
8931 !! end
8932
8933 !! test
8934 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8935 !! input
8936 {{div style|" ><script>alert(document.cookie)</script>}}
8937 !! result
8938 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8939
8940 !! end
8941
8942 !! test
8943 Bug 2304: HTML attribute safety (link)
8944 !! input
8945 <div title="[[Main Page]]"></div>
8946 !! result
8947 <div title="&#91;&#91;Main Page]]"></div>
8948
8949 !! end
8950
8951 !! test
8952 Bug 2304: HTML attribute safety (italics)
8953 !! input
8954 <div title="''foobar''"></div>
8955 !! result
8956 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8957
8958 !! end
8959
8960 !! test
8961 Bug 2304: HTML attribute safety (bold)
8962 !! input
8963 <div title="'''foobar'''"></div>
8964 !! result
8965 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8966
8967 !! end
8968
8969
8970 !! test
8971 Bug 2304: HTML attribute safety (ISBN)
8972 !! input
8973 <div title="ISBN 1234567890"></div>
8974 !! result
8975 <div title="&#73;SBN 1234567890"></div>
8976
8977 !! end
8978
8979 !! test
8980 Bug 2304: HTML attribute safety (RFC)
8981 !! input
8982 <div title="RFC 1234"></div>
8983 !! result
8984 <div title="&#82;FC 1234"></div>
8985
8986 !! end
8987
8988 !! test
8989 Bug 2304: HTML attribute safety (PMID)
8990 !! input
8991 <div title="PMID 1234567890"></div>
8992 !! result
8993 <div title="&#80;MID 1234567890"></div>
8994
8995 !! end
8996
8997 !! test
8998 Bug 2304: HTML attribute safety (web link)
8999 !! input
9000 <div title="http://example.com/"></div>
9001 !! result
9002 <div title="http&#58;//example.com/"></div>
9003
9004 !! end
9005
9006 !! test
9007 Bug 2304: HTML attribute safety (named web link)
9008 !! input
9009 <div title="[http://example.com/ link]"></div>
9010 !! result
9011 <div title="&#91;http&#58;//example.com/ link]"></div>
9012
9013 !! end
9014
9015 !! test
9016 Bug 3244: HTML attribute safety (extension; safe)
9017 !! input
9018 <div style="<nowiki>background:blue</nowiki>"></div>
9019 !! result
9020 <div style="background:blue"></div>
9021
9022 !! end
9023
9024 !! test
9025 Bug 3244: HTML attribute safety (extension; unsafe)
9026 !! input
9027 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9028 !! result
9029 <div style="/* insecure input */"></div>
9030
9031 !! end
9032
9033 # More MSIE fun discovered by Tom Gilder
9034
9035 !! test
9036 MSIE CSS safety test: spurious slash
9037 !! input
9038 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9039 !! result
9040 <div style="/* insecure input */">evil</div>
9041
9042 !! end
9043
9044 !! test
9045 MSIE CSS safety test: hex code
9046 !! input
9047 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9048 !! result
9049 <div style="/* insecure input */">evil</div>
9050
9051 !! end
9052
9053 !! test
9054 MSIE CSS safety test: comment in url
9055 !! input
9056 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9057 !! result
9058 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9059
9060 !! end
9061
9062 !! test
9063 MSIE CSS safety test: comment in expression
9064 !! input
9065 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9066 !! result
9067 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9068
9069 !! end
9070
9071
9072 !! test
9073 Table attribute legitimate extension
9074 !! input
9075 {|
9076 !+ style="<nowiki>color:blue</nowiki>"| status
9077 |}
9078 !! result
9079 <table>
9080 <tr>
9081 <th style="color:blue"> status
9082 </th></tr></table>
9083
9084 !!end
9085
9086 !! test
9087 Table attribute safety
9088 !! input
9089 {|
9090 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9091 |}
9092 !! result
9093 <table>
9094 <tr>
9095 <th style="/* insecure input */"> status
9096 </th></tr></table>
9097
9098 !! end
9099
9100 !! test
9101 CSS line continuation 1
9102 !! input
9103 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9104 !! result
9105 <div style="/* insecure input */"></div>
9106
9107 !! end
9108
9109 !! test
9110 CSS line continuation 2
9111 !! input
9112 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9113 !! result
9114 <div style="/* insecure input */"></div>
9115
9116 !! end
9117
9118 !! article
9119 Template:Identity
9120 !! text
9121 {{{1}}}
9122 !! endarticle
9123
9124 !! test
9125 Expansion of multi-line templates in attribute values (bug 6255)
9126 !! input
9127 <div style="background: {{identity|#00FF00}}">-</div>
9128 !! result
9129 <div style="background: #00FF00">-</div>
9130
9131 !! end
9132
9133
9134 !! test
9135 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9136 !! input
9137 <div style="background:
9138 #00FF00">-</div>
9139 !! result
9140 <div style="background: #00FF00">-</div>
9141
9142 !! end
9143
9144 !! test
9145 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9146 !! input
9147 <div style="background: &#10;#00FF00">-</div>
9148 !! result
9149 <div style="background: &#10;#00FF00">-</div>
9150
9151 !! end
9152
9153 ###
9154 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9155 ###
9156 !! test
9157 Parser hook: empty input
9158 !! input
9159 <tag></tag>
9160 !! result
9161 <pre>
9162 ''
9163 array (
9164 )
9165 </pre>
9166
9167 !! end
9168
9169 !! test
9170 Parser hook: empty input using terminated empty elements
9171 !! input
9172 <tag/>
9173 !! result
9174 <pre>
9175 NULL
9176 array (
9177 )
9178 </pre>
9179
9180 !! end
9181
9182 !! test
9183 Parser hook: empty input using terminated empty elements (space before)
9184 !! input
9185 <tag />
9186 !! result
9187 <pre>
9188 NULL
9189 array (
9190 )
9191 </pre>
9192
9193 !! end
9194
9195 !! test
9196 Parser hook: basic input
9197 !! input
9198 <tag>input</tag>
9199 !! result
9200 <pre>
9201 'input'
9202 array (
9203 )
9204 </pre>
9205
9206 !! end
9207
9208
9209 !! test
9210 Parser hook: case insensitive
9211 !! input
9212 <TAG>input</TAG>
9213 !! result
9214 <pre>
9215 'input'
9216 array (
9217 )
9218 </pre>
9219
9220 !! end
9221
9222
9223 !! test
9224 Parser hook: case insensitive, redux
9225 !! input
9226 <TaG>input</TAg>
9227 !! result
9228 <pre>
9229 'input'
9230 array (
9231 )
9232 </pre>
9233
9234 !! end
9235
9236 !! test
9237 Parser hook: nested tags
9238 !! options
9239 noxml
9240 !! input
9241 <tag><tag></tag></tag>
9242 !! result
9243 <pre>
9244 '<tag>'
9245 array (
9246 )
9247 </pre>&lt;/tag&gt;
9248
9249 !! end
9250
9251 !! test
9252 Parser hook: basic arguments
9253 !! input
9254 <tag width=200 height = "100" depth = '50' square></tag>
9255 !! result
9256 <pre>
9257 ''
9258 array (
9259 'width' => '200',
9260 'height' => '100',
9261 'depth' => '50',
9262 'square' => 'square',
9263 )
9264 </pre>
9265
9266 !! end
9267
9268 !! test
9269 Parser hook: argument containing a forward slash (bug 5344)
9270 !! input
9271 <tag filename='/tmp/bla'></tag>
9272 !! result
9273 <pre>
9274 ''
9275 array (
9276 'filename' => '/tmp/bla',
9277 )
9278 </pre>
9279
9280 !! end
9281
9282 !! test
9283 Parser hook: empty input using terminated empty elements (bug 2374)
9284 !! input
9285 <tag foo=bar/>text
9286 !! result
9287 <pre>
9288 NULL
9289 array (
9290 'foo' => 'bar',
9291 )
9292 </pre>text
9293
9294 !! end
9295
9296 # </tag> should be output literally since there is no matching tag that begins it
9297 !! test
9298 Parser hook: basic arguments using terminated empty elements (bug 2374)
9299 !! input
9300 <tag width=200 height = "100" depth = '50' square/>
9301 other stuff
9302 </tag>
9303 !! result
9304 <pre>
9305 NULL
9306 array (
9307 'width' => '200',
9308 'height' => '100',
9309 'depth' => '50',
9310 'square' => 'square',
9311 )
9312 </pre>
9313 <p>other stuff
9314 &lt;/tag&gt;
9315 </p>
9316 !! end
9317
9318 ###
9319 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9320 ###
9321
9322 !! test
9323 Parser hook: static parser hook not inside a comment
9324 !! input
9325 <statictag>hello, world</statictag>
9326 <statictag action=flush/>
9327 !! result
9328 <p>hello, world
9329 </p>
9330 !! end
9331
9332
9333 !! test
9334 Parser hook: static parser hook inside a comment
9335 !! input
9336 <!-- <statictag>hello, world</statictag> -->
9337 <statictag action=flush/>
9338 !! result
9339 <p><br />
9340 </p>
9341 !! end
9342
9343 # Nested template calls; this case was broken by Parser.php rev 1.506,
9344 # since reverted.
9345
9346 !! article
9347 Template:One-parameter
9348 !! text
9349 (My parameter is: {{{1}}})
9350 !! endarticle
9351
9352 !! article
9353 Template:Map-one-parameter
9354 !! text
9355 {{{{{1}}}|{{{2}}}}}
9356 !! endarticle
9357
9358 !! test
9359 Nested template calls
9360 !! input
9361 {{Map-one-parameter|One-parameter|param}}
9362 !! result
9363 <p>(My parameter is: param)
9364 </p>
9365 !! end
9366
9367
9368 ###
9369 ### Sanitizer
9370 ###
9371 !! test
9372 Sanitizer: Closing of open tags
9373 !! input
9374 <s></s><table></table>
9375 !! result
9376 <s></s><table></table>
9377
9378 !! end
9379
9380 !! test
9381 Sanitizer: Closing of open but not closed tags
9382 !! input
9383 <s>foo
9384 !! result
9385 <p><s>foo</s>
9386 </p>
9387 !! end
9388
9389 !! test
9390 Sanitizer: Closing of closed but not open tags
9391 !! input
9392 </s>
9393 !! result
9394 <p>&lt;/s&gt;
9395 </p>
9396 !! end
9397
9398 !! test
9399 Sanitizer: Closing of closed but not open table tags
9400 !! input
9401 Table not started</td></tr></table>
9402 !! result
9403 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9404 </p>
9405 !! end
9406
9407 !! test
9408 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9409 !! input
9410 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9411 !! result
9412 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9413 </p>
9414 !! end
9415
9416 !! test
9417 Sanitizer: Validating the contents of the id attribute (bug 4515)
9418 !! options
9419 disabled
9420 !! input
9421 <br id=9 />
9422 !! result
9423 Something, but definitely not <br id="9" />...
9424 !! end
9425
9426 !! test
9427 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9428 !! options
9429 disabled
9430 !! input
9431 <br id="foo" /><br id="foo" />
9432 !! result
9433 Something need to be done. foo-2 ?
9434 !! end
9435
9436 !! test
9437 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9438 !! input
9439 <div itemscope>
9440 <meta itemprop="hello" content="world">
9441 <meta http-equiv="refresh" content="5">
9442 <meta itemprop="hello" http-equiv="refresh" content="5">
9443 <link itemprop="hello" href="{{SERVER}}">
9444 <link rel="stylesheet" href="{{SERVER}}">
9445 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9446 </div>
9447 !! result
9448 <div itemscope="itemscope">
9449 <p> <meta itemprop="hello" content="world" />
9450 &lt;meta http-equiv="refresh" content="5"&gt;
9451 <meta itemprop="hello" content="5" />
9452 </p>
9453 <link itemprop="hello" href="http&#58;//example.org" />
9454 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9455 <link itemprop="hello" href="http&#58;//example.org" />
9456 </div>
9457
9458 !! end
9459
9460 !! test
9461 Language converter: output gets cut off unexpectedly (bug 5757)
9462 !! options
9463 language=zh
9464 !! input
9465 this bit is safe: }-
9466
9467 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9468
9469 then we get cut off here: }-
9470
9471 all additional text is vanished
9472 !! result
9473 <p>this bit is safe: }-
9474 </p><p>but if we add a conversion instance: xxx
9475 </p><p>then we get cut off here: }-
9476 </p><p>all additional text is vanished
9477 </p>
9478 !! end
9479
9480 !! test
9481 Self closed html pairs (bug 5487)
9482 !! options
9483 !! input
9484 <center><font id="bug" />Centered text</center>
9485 <div><font id="bug2" />In div text</div>
9486 !! result
9487 <center>&lt;font id="bug" /&gt;Centered text</center>
9488 <div>&lt;font id="bug2" /&gt;In div text</div>
9489
9490 !! end
9491
9492 #
9493 #
9494 #
9495
9496 !! test
9497 Punctuation: nbsp before exclamation
9498 !! input
9499 C'est grave !
9500 !! result
9501 <p>C'est grave&#160;!
9502 </p>
9503 !! end
9504
9505 !! test
9506 Punctuation: CSS !important (bug 11874)
9507 !! input
9508 <div style="width:50% !important">important</div>
9509 !! result
9510 <div style="width:50% !important">important</div>
9511
9512 !!end
9513
9514 !! test
9515 Punctuation: CSS ! important (bug 11874; with space after)
9516 !! input
9517 <div style="width:50% ! important">important</div>
9518 !! result
9519 <div style="width:50% ! important">important</div>
9520
9521 !!end
9522
9523
9524 !! test
9525 HTML bullet list, closed tags (bug 5497)
9526 !! input
9527 <ul>
9528 <li>One</li>
9529 <li>Two</li>
9530 </ul>
9531 !! result
9532 <ul>
9533 <li>One</li>
9534 <li>Two</li>
9535 </ul>
9536
9537 !! end
9538
9539 !! test
9540 HTML bullet list, unclosed tags (bug 5497)
9541 !! options
9542 disabled
9543 !! input
9544 <ul>
9545 <li>One
9546 <li>Two
9547 </ul>
9548 !! result
9549 <ul>
9550 <li>One
9551 </li><li>Two
9552 </li></ul>
9553
9554 !! end
9555
9556 !! test
9557 HTML ordered list, closed tags (bug 5497)
9558 !! input
9559 <ol>
9560 <li>One</li>
9561 <li>Two</li>
9562 </ol>
9563 !! result
9564 <ol>
9565 <li>One</li>
9566 <li>Two</li>
9567 </ol>
9568
9569 !! end
9570
9571 !! test
9572 HTML ordered list, unclosed tags (bug 5497)
9573 !! options
9574 disabled
9575 !! input
9576 <ol>
9577 <li>One
9578 <li>Two
9579 </ol>
9580 !! result
9581 <ol>
9582 <li>One
9583 </li><li>Two
9584 </li></ol>
9585
9586 !! end
9587
9588 !! test
9589 HTML nested bullet list, closed tags (bug 5497)
9590 !! input
9591 <ul>
9592 <li>One</li>
9593 <li>Two:
9594 <ul>
9595 <li>Sub-one</li>
9596 <li>Sub-two</li>
9597 </ul>
9598 </li>
9599 </ul>
9600 !! result
9601 <ul>
9602 <li>One</li>
9603 <li>Two:
9604 <ul>
9605 <li>Sub-one</li>
9606 <li>Sub-two</li>
9607 </ul>
9608 </li>
9609 </ul>
9610
9611 !! end
9612
9613 !! test
9614 HTML nested bullet list, open tags (bug 5497)
9615 !! options
9616 disabled
9617 !! input
9618 <ul>
9619 <li>One
9620 <li>Two:
9621 <ul>
9622 <li>Sub-one
9623 <li>Sub-two
9624 </ul>
9625 </ul>
9626 !! result
9627 <ul>
9628 <li>One
9629 </li><li>Two:
9630 <ul>
9631 <li>Sub-one
9632 </li><li>Sub-two
9633 </li></ul>
9634 </li></ul>
9635
9636 !! end
9637
9638 !! test
9639 HTML nested ordered list, closed tags (bug 5497)
9640 !! input
9641 <ol>
9642 <li>One</li>
9643 <li>Two:
9644 <ol>
9645 <li>Sub-one</li>
9646 <li>Sub-two</li>
9647 </ol>
9648 </li>
9649 </ol>
9650 !! result
9651 <ol>
9652 <li>One</li>
9653 <li>Two:
9654 <ol>
9655 <li>Sub-one</li>
9656 <li>Sub-two</li>
9657 </ol>
9658 </li>
9659 </ol>
9660
9661 !! end
9662
9663 !! test
9664 HTML nested ordered list, open tags (bug 5497)
9665 !! options
9666 disabled
9667 !! input
9668 <ol>
9669 <li>One
9670 <li>Two:
9671 <ol>
9672 <li>Sub-one
9673 <li>Sub-two
9674 </ol>
9675 </ol>
9676 !! result
9677 <ol>
9678 <li>One
9679 </li><li>Two:
9680 <ol>
9681 <li>Sub-one
9682 </li><li>Sub-two
9683 </li></ol>
9684 </li></ol>
9685
9686 !! end
9687
9688 !! test
9689 HTML ordered list item with parameters oddity
9690 !! input
9691 <ol><li id="fragment">One</li></ol>
9692 !! result
9693 <ol><li id="fragment">One</li></ol>
9694
9695 !! end
9696
9697 !!test
9698 bug 5918: autonumbering
9699 !! input
9700 [http://first/] [http://second] [ftp://ftp]
9701
9702 ftp://inlineftp
9703
9704 [mailto:enclosed@mail.tld With target]
9705
9706 [mailto:enclosed@mail.tld]
9707
9708 mailto:inline@mail.tld
9709 !! result
9710 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
9711 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9712 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9713 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9714 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9715 </p>
9716 !! end
9717
9718
9719 #
9720 # Security and HTML correctness
9721 # From Nick Jenkins' fuzz testing
9722 #
9723
9724 !! test
9725 Fuzz testing: Parser13
9726 !! input
9727 {|
9728 | http://a|
9729 !! result
9730 <table>
9731 <tr>
9732 <td>
9733 </td>
9734 </tr>
9735 </table>
9736
9737 !! end
9738
9739 !! test
9740 Fuzz testing: Parser14
9741 !! input
9742 == onmouseover= ==
9743 http://__TOC__
9744 !! result
9745 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline" id="onmouseover.3D">onmouseover=</span></h2>
9746 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9747 <ul>
9748 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9749 </ul>
9750 </td></tr></table>
9751
9752 !! end
9753
9754 !! test
9755 Fuzz testing: Parser14-table
9756 !! input
9757 ==a==
9758 {| STYLE=__TOC__
9759 !! result
9760 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2>
9761 <table style="&#95;_TOC&#95;_">
9762 <tr><td></td></tr>
9763 </table>
9764
9765 !! end
9766
9767 # Known to produce bogus xml (extra </td>)
9768 !! test
9769 Fuzz testing: Parser16
9770 !! options
9771 noxml
9772 !! input
9773 {|
9774 !https://||||||
9775 !! result
9776 <table>
9777 <tr>
9778 <th>https://</th>
9779 <th></th>
9780 <th></th>
9781 <th>
9782 </td>
9783 </tr>
9784 </table>
9785
9786 !! end
9787
9788 !! test
9789 Fuzz testing: Parser21
9790 !! input
9791 {|
9792 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9793 |
9794 !! result
9795 <table>
9796 <tr>
9797 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9798 </th>
9799 <td>
9800 </td>
9801 </tr>
9802 </table>
9803
9804 !! end
9805
9806 !! test
9807 Fuzz testing: Parser22
9808 !! input
9809 http://===r:::https://b
9810
9811 {|
9812 !!result
9813 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9814 </p>
9815 <table>
9816 <tr><td></td></tr>
9817 </table>
9818
9819 !! end
9820
9821 # Known to produce bad XML for now
9822 !! test
9823 Fuzz testing: Parser24
9824 !! options
9825 noxml
9826 !! input
9827 {|
9828 {{{|
9829 <u CLASS=
9830 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9831 <br style="onmouseover='alert(document.cookie);' " />
9832
9833 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9834 |
9835 !! result
9836 <table>
9837 {{{|
9838 <u class="&#124;">}}}} &gt;
9839 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9840
9841 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9842 <tr>
9843 <td></u>
9844 </td>
9845 </tr>
9846 </table>
9847
9848 !! end
9849
9850 # Note: the current result listed for this is not what the original one was,
9851 # but the original bug was JavaScript injection, which is fixed in any case.
9852 # It's not clear that the original result listed was any more correct than the
9853 # current one. Original result:
9854 # <p>{{{|
9855 # </p>
9856 # <li class="&#124;&#124;">
9857 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9858 !!test
9859 Fuzz testing: Parser25 (bug 6055)
9860 !! input
9861 {{{
9862 |
9863 <LI CLASS=||
9864 >
9865 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9866 !! result
9867 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9868 </p>
9869 !! end
9870
9871 !!test
9872 Fuzz testing: URL adjacent extension (with space, clean)
9873 !! options
9874 !! input
9875 http://example.com <nowiki>junk</nowiki>
9876 !! result
9877 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9878 </p>
9879 !!end
9880
9881 !!test
9882 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9883 !! options
9884 !! input
9885 http://example.com<nowiki>junk</nowiki>
9886 !! result
9887 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9888 </p>
9889 !!end
9890
9891 !!test
9892 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9893 !! options
9894 !! input
9895 http://example.com<pre>junk</pre>
9896 !! result
9897 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9898
9899 !!end
9900
9901 !!test
9902 Fuzz testing: image with bogus manual thumbnail
9903 !!input
9904 [[Image:foobar.jpg|thumbnail= ]]
9905 !!result
9906 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9907
9908 !!end
9909
9910 !! test
9911 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9912 !! input
9913 <pre dir="&#10;"></pre>
9914 !! result
9915 <pre dir="&#10;"></pre>
9916
9917 !! end
9918
9919 !! test
9920 Parsing optional HTML elements (Bug 6171)
9921 !! options
9922 !! input
9923 <table>
9924 <tr>
9925 <td> Some tabular data</td>
9926 <td> More tabular data ...
9927 <td> And yet som tabular data</td>
9928 </tr>
9929 </table>
9930 !! result
9931 <table>
9932 <tr>
9933 <td> Some tabular data</td>
9934 <td> More tabular data ...
9935 </td><td> And yet som tabular data</td>
9936 </tr>
9937 </table>
9938
9939 !! end
9940
9941 !! test
9942 Correct handling of <td>, <tr> (Bug 6171)
9943 !! options
9944 !! input
9945 <table>
9946 <tr>
9947 <td> Some tabular data</td>
9948 <td> More tabular data ...</td>
9949 <td> And yet som tabular data</td>
9950 </tr>
9951 </table>
9952 !! result
9953 <table>
9954 <tr>
9955 <td> Some tabular data</td>
9956 <td> More tabular data ...</td>
9957 <td> And yet som tabular data</td>
9958 </tr>
9959 </table>
9960
9961 !! end
9962
9963
9964 !! test
9965 Parsing crashing regression (fr:JavaScript)
9966 !! input
9967 </body></x>
9968 !! result
9969 <p>&lt;/body&gt;&lt;/x&gt;
9970 </p>
9971 !! end
9972
9973 !! test
9974 Inline wiki vs wiki block nesting
9975 !! input
9976 '''Bold paragraph
9977
9978 New wiki paragraph
9979 !! result
9980 <p><b>Bold paragraph</b>
9981 </p><p>New wiki paragraph
9982 </p>
9983 !! end
9984
9985 !! test
9986 Inline HTML vs wiki block nesting
9987 !! options
9988 disabled
9989 !! input
9990 <b>Bold paragraph
9991
9992 New wiki paragraph
9993 !! result
9994 <p><b>Bold paragraph</b>
9995 </p><p>New wiki paragraph
9996 </p>
9997 !! end
9998
9999 # Original result was this:
10000 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10001 # </p>
10002 # While that might be marginally more intuitive, maybe, the six-apostrophe
10003 # construct is clearly pathological and the result stated here (which is what
10004 # the parser actually does) is about as reasonable as anything.
10005 !!test
10006 Mixing markup for italics and bold
10007 !! options
10008 !! input
10009 '''bold''''''bold''bolditalics'''''
10010 !! result
10011 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10012 </p>
10013 !! end
10014
10015
10016 !! article
10017 Xyzzyx
10018 !! text
10019 Article for special page transclusion test
10020 !! endarticle
10021
10022 !! test
10023 Special page transclusion
10024 !! options
10025 !! input
10026 {{Special:Prefixindex/Xyzzyx}}
10027 !! result
10028 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10029
10030 !! end
10031
10032 !! test
10033 Special page transclusion twice (bug 5021)
10034 !! options
10035 !! input
10036 {{Special:Prefixindex/Xyzzyx}}
10037 {{Special:Prefixindex/Xyzzyx}}
10038 !! result
10039 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10040 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10041
10042 !! end
10043
10044 !! test
10045 Transclusion of default MediaWiki message
10046 !! input
10047 {{MediaWiki:Mainpage}}
10048 !!result
10049 <p>Main Page
10050 </p>
10051 !! end
10052
10053 !! test
10054 Transclusion of nonexistent MediaWiki message
10055 !! input
10056 {{MediaWiki:Mainpagexxx}}
10057 !!result
10058 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
10059 </p>
10060 !! end
10061
10062 !! test
10063 Transclusion of MediaWiki message with underscore
10064 !! input
10065 {{MediaWiki:history_short}}
10066 !! result
10067 <p>History
10068 </p>
10069 !! end
10070
10071 !! test
10072 Transclusion of MediaWiki message with space
10073 !! input
10074 {{MediaWiki:history short}}
10075 !! result
10076 <p>History
10077 </p>
10078 !! end
10079
10080 !! test
10081 Invalid header with following text
10082 !! input
10083 = x = y
10084 !! result
10085 <p>= x = y
10086 </p>
10087 !! end
10088
10089
10090 !! test
10091 Section extraction test (section 0)
10092 !! options
10093 section=0
10094 !! input
10095 start
10096 ==a==
10097 ===aa===
10098 ====aaa====
10099 ==b==
10100 ===ba===
10101 ===bb===
10102 ====bba====
10103 ===bc===
10104 ==c==
10105 ===ca===
10106 !! result
10107 start
10108 !! end
10109
10110 !! test
10111 Section extraction test (section 1)
10112 !! options
10113 section=1
10114 !! input
10115 start
10116 ==a==
10117 ===aa===
10118 ====aaa====
10119 ==b==
10120 ===ba===
10121 ===bb===
10122 ====bba====
10123 ===bc===
10124 ==c==
10125 ===ca===
10126 !! result
10127 ==a==
10128 ===aa===
10129 ====aaa====
10130 !! end
10131
10132 !! test
10133 Section extraction test (section 2)
10134 !! options
10135 section=2
10136 !! input
10137 start
10138 ==a==
10139 ===aa===
10140 ====aaa====
10141 ==b==
10142 ===ba===
10143 ===bb===
10144 ====bba====
10145 ===bc===
10146 ==c==
10147 ===ca===
10148 !! result
10149 ===aa===
10150 ====aaa====
10151 !! end
10152
10153 !! test
10154 Section extraction test (section 3)
10155 !! options
10156 section=3
10157 !! input
10158 start
10159 ==a==
10160 ===aa===
10161 ====aaa====
10162 ==b==
10163 ===ba===
10164 ===bb===
10165 ====bba====
10166 ===bc===
10167 ==c==
10168 ===ca===
10169 !! result
10170 ====aaa====
10171 !! end
10172
10173 !! test
10174 Section extraction test (section 4)
10175 !! options
10176 section=4
10177 !! input
10178 start
10179 ==a==
10180 ===aa===
10181 ====aaa====
10182 ==b==
10183 ===ba===
10184 ===bb===
10185 ====bba====
10186 ===bc===
10187 ==c==
10188 ===ca===
10189 !! result
10190 ==b==
10191 ===ba===
10192 ===bb===
10193 ====bba====
10194 ===bc===
10195 !! end
10196
10197 !! test
10198 Section extraction test (section 5)
10199 !! options
10200 section=5
10201 !! input
10202 start
10203 ==a==
10204 ===aa===
10205 ====aaa====
10206 ==b==
10207 ===ba===
10208 ===bb===
10209 ====bba====
10210 ===bc===
10211 ==c==
10212 ===ca===
10213 !! result
10214 ===ba===
10215 !! end
10216
10217 !! test
10218 Section extraction test (section 6)
10219 !! options
10220 section=6
10221 !! input
10222 start
10223 ==a==
10224 ===aa===
10225 ====aaa====
10226 ==b==
10227 ===ba===
10228 ===bb===
10229 ====bba====
10230 ===bc===
10231 ==c==
10232 ===ca===
10233 !! result
10234 ===bb===
10235 ====bba====
10236 !! end
10237
10238 !! test
10239 Section extraction test (section 7)
10240 !! options
10241 section=7
10242 !! input
10243 start
10244 ==a==
10245 ===aa===
10246 ====aaa====
10247 ==b==
10248 ===ba===
10249 ===bb===
10250 ====bba====
10251 ===bc===
10252 ==c==
10253 ===ca===
10254 !! result
10255 ====bba====
10256 !! end
10257
10258 !! test
10259 Section extraction test (section 8)
10260 !! options
10261 section=8
10262 !! input
10263 start
10264 ==a==
10265 ===aa===
10266 ====aaa====
10267 ==b==
10268 ===ba===
10269 ===bb===
10270 ====bba====
10271 ===bc===
10272 ==c==
10273 ===ca===
10274 !! result
10275 ===bc===
10276 !! end
10277
10278 !! test
10279 Section extraction test (section 9)
10280 !! options
10281 section=9
10282 !! input
10283 start
10284 ==a==
10285 ===aa===
10286 ====aaa====
10287 ==b==
10288 ===ba===
10289 ===bb===
10290 ====bba====
10291 ===bc===
10292 ==c==
10293 ===ca===
10294 !! result
10295 ==c==
10296 ===ca===
10297 !! end
10298
10299 !! test
10300 Section extraction test (section 10)
10301 !! options
10302 section=10
10303 !! input
10304 start
10305 ==a==
10306 ===aa===
10307 ====aaa====
10308 ==b==
10309 ===ba===
10310 ===bb===
10311 ====bba====
10312 ===bc===
10313 ==c==
10314 ===ca===
10315 !! result
10316 ===ca===
10317 !! end
10318
10319 !! test
10320 Section extraction test (nonexistent section 11)
10321 !! options
10322 section=11
10323 !! input
10324 start
10325 ==a==
10326 ===aa===
10327 ====aaa====
10328 ==b==
10329 ===ba===
10330 ===bb===
10331 ====bba====
10332 ===bc===
10333 ==c==
10334 ===ca===
10335 !! result
10336 !! end
10337
10338 !! test
10339 Section extraction test with bogus heading (section 1)
10340 !! options
10341 section=1
10342 !! input
10343 ==a==
10344 ==bogus== not a legal section
10345 ==b==
10346 !! result
10347 ==a==
10348 ==bogus== not a legal section
10349 !! end
10350
10351 !! test
10352 Section extraction test with bogus heading (section 2)
10353 !! options
10354 section=2
10355 !! input
10356 ==a==
10357 ==bogus== not a legal section
10358 ==b==
10359 !! result
10360 ==b==
10361 !! end
10362
10363 !! test
10364 Section extraction test with comment after heading (section 1)
10365 !! options
10366 section=1
10367 !! input
10368 ==a==
10369 ==b== <!-- -->
10370 ==c==
10371 !! result
10372 ==a==
10373 !! end
10374
10375 !! test
10376 Section extraction test with comment after heading (section 2)
10377 !! options
10378 section=2
10379 !! input
10380 ==a==
10381 ==b== <!-- -->
10382 ==c==
10383 !! result
10384 ==b== <!-- -->
10385 !! end
10386
10387 !! test
10388 Section extraction test with bogus <nowiki> heading (section 1)
10389 !! options
10390 section=1
10391 !! input
10392 ==a==
10393 ==bogus== <nowiki>not a legal section</nowiki>
10394 ==b==
10395 !! result
10396 ==a==
10397 ==bogus== <nowiki>not a legal section</nowiki>
10398 !! end
10399
10400 !! test
10401 Section extraction test with bogus <nowiki> heading (section 2)
10402 !! options
10403 section=2
10404 !! input
10405 ==a==
10406 ==bogus== <nowiki>not a legal section</nowiki>
10407 ==b==
10408 !! result
10409 ==b==
10410 !! end
10411
10412
10413 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10414 # instead of respecting commented sections
10415 !! test
10416 Section extraction prefixed by comment (section 1)
10417 !! options
10418 section=1
10419 !! input
10420 <!-- -->==sec1==
10421 ==sec2==
10422 !!result
10423 ==sec2==
10424 !!end
10425
10426 !! test
10427 Section extraction prefixed by comment (section 2)
10428 !! options
10429 section=2
10430 !! input
10431 <!-- -->==sec1==
10432 ==sec2==
10433 !!result
10434
10435 !!end
10436
10437
10438 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10439 # instead of respecting HTML-style headings
10440 !! test
10441 Section extraction, mixed wiki and html (section 1)
10442 !! options
10443 section=1
10444 !! input
10445 <h2>unmarked</h2>
10446 unmarked
10447 ==1==
10448 one
10449 ==2==
10450 two
10451 !! result
10452 ==1==
10453 one
10454 !! end
10455
10456 !! test
10457 Section extraction, mixed wiki and html (section 2)
10458 !! options
10459 section=2
10460 !! input
10461 <h2>unmarked</h2>
10462 unmarked
10463 ==1==
10464 one
10465 ==2==
10466 two
10467 !! result
10468 ==2==
10469 two
10470 !! end
10471
10472
10473 # Formerly testing for bug 3342
10474 !! test
10475 Section extraction, heading surrounded by <noinclude>
10476 !! options
10477 section=1
10478 !! input
10479 <noinclude>==unmarked==</noinclude>
10480 ==marked==
10481 !! result
10482 ==marked==
10483 !!end
10484
10485 # Test behavior of bug 19910
10486 !! test
10487 Sectiion with all-equals
10488 !! options
10489 section=2
10490 !! input
10491 ===
10492 The line above must have a trailing space
10493 === <!--
10494 --> <!-- -->
10495 But just in case it doesn't...
10496 !! result
10497 === <!--
10498 --> <!-- -->
10499 But just in case it doesn't...
10500 !! end
10501
10502 !! test
10503 Section replacement test (section 0)
10504 !! options
10505 replace=0,"xxx"
10506 !! input
10507 start
10508 ==a==
10509 ===aa===
10510 ====aaa====
10511 ==b==
10512 ===ba===
10513 ===bb===
10514 ====bba====
10515 ===bc===
10516 ==c==
10517 ===ca===
10518 !! result
10519 xxx
10520
10521 ==a==
10522 ===aa===
10523 ====aaa====
10524 ==b==
10525 ===ba===
10526 ===bb===
10527 ====bba====
10528 ===bc===
10529 ==c==
10530 ===ca===
10531 !! end
10532
10533 !! test
10534 Section replacement test (section 1)
10535 !! options
10536 replace=1,"xxx"
10537 !! input
10538 start
10539 ==a==
10540 ===aa===
10541 ====aaa====
10542 ==b==
10543 ===ba===
10544 ===bb===
10545 ====bba====
10546 ===bc===
10547 ==c==
10548 ===ca===
10549 !! result
10550 start
10551 xxx
10552
10553 ==b==
10554 ===ba===
10555 ===bb===
10556 ====bba====
10557 ===bc===
10558 ==c==
10559 ===ca===
10560 !! end
10561
10562 !! test
10563 Section replacement test (section 2)
10564 !! options
10565 replace=2,"xxx"
10566 !! input
10567 start
10568 ==a==
10569 ===aa===
10570 ====aaa====
10571 ==b==
10572 ===ba===
10573 ===bb===
10574 ====bba====
10575 ===bc===
10576 ==c==
10577 ===ca===
10578 !! result
10579 start
10580 ==a==
10581 xxx
10582
10583 ==b==
10584 ===ba===
10585 ===bb===
10586 ====bba====
10587 ===bc===
10588 ==c==
10589 ===ca===
10590 !! end
10591
10592 !! test
10593 Section replacement test (section 3)
10594 !! options
10595 replace=3,"xxx"
10596 !! input
10597 start
10598 ==a==
10599 ===aa===
10600 ====aaa====
10601 ==b==
10602 ===ba===
10603 ===bb===
10604 ====bba====
10605 ===bc===
10606 ==c==
10607 ===ca===
10608 !! result
10609 start
10610 ==a==
10611 ===aa===
10612 xxx
10613
10614 ==b==
10615 ===ba===
10616 ===bb===
10617 ====bba====
10618 ===bc===
10619 ==c==
10620 ===ca===
10621 !! end
10622
10623 !! test
10624 Section replacement test (section 4)
10625 !! options
10626 replace=4,"xxx"
10627 !! input
10628 start
10629 ==a==
10630 ===aa===
10631 ====aaa====
10632 ==b==
10633 ===ba===
10634 ===bb===
10635 ====bba====
10636 ===bc===
10637 ==c==
10638 ===ca===
10639 !! result
10640 start
10641 ==a==
10642 ===aa===
10643 ====aaa====
10644 xxx
10645
10646 ==c==
10647 ===ca===
10648 !! end
10649
10650 !! test
10651 Section replacement test (section 5)
10652 !! options
10653 replace=5,"xxx"
10654 !! input
10655 start
10656 ==a==
10657 ===aa===
10658 ====aaa====
10659 ==b==
10660 ===ba===
10661 ===bb===
10662 ====bba====
10663 ===bc===
10664 ==c==
10665 ===ca===
10666 !! result
10667 start
10668 ==a==
10669 ===aa===
10670 ====aaa====
10671 ==b==
10672 xxx
10673
10674 ===bb===
10675 ====bba====
10676 ===bc===
10677 ==c==
10678 ===ca===
10679 !! end
10680
10681 !! test
10682 Section replacement test (section 6)
10683 !! options
10684 replace=6,"xxx"
10685 !! input
10686 start
10687 ==a==
10688 ===aa===
10689 ====aaa====
10690 ==b==
10691 ===ba===
10692 ===bb===
10693 ====bba====
10694 ===bc===
10695 ==c==
10696 ===ca===
10697 !! result
10698 start
10699 ==a==
10700 ===aa===
10701 ====aaa====
10702 ==b==
10703 ===ba===
10704 xxx
10705
10706 ===bc===
10707 ==c==
10708 ===ca===
10709 !! end
10710
10711 !! test
10712 Section replacement test (section 7)
10713 !! options
10714 replace=7,"xxx"
10715 !! input
10716 start
10717 ==a==
10718 ===aa===
10719 ====aaa====
10720 ==b==
10721 ===ba===
10722 ===bb===
10723 ====bba====
10724 ===bc===
10725 ==c==
10726 ===ca===
10727 !! result
10728 start
10729 ==a==
10730 ===aa===
10731 ====aaa====
10732 ==b==
10733 ===ba===
10734 ===bb===
10735 xxx
10736
10737 ===bc===
10738 ==c==
10739 ===ca===
10740 !! end
10741
10742 !! test
10743 Section replacement test (section 8)
10744 !! options
10745 replace=8,"xxx"
10746 !! input
10747 start
10748 ==a==
10749 ===aa===
10750 ====aaa====
10751 ==b==
10752 ===ba===
10753 ===bb===
10754 ====bba====
10755 ===bc===
10756 ==c==
10757 ===ca===
10758 !! result
10759 start
10760 ==a==
10761 ===aa===
10762 ====aaa====
10763 ==b==
10764 ===ba===
10765 ===bb===
10766 ====bba====
10767 xxx
10768
10769 ==c==
10770 ===ca===
10771 !!end
10772
10773 !! test
10774 Section replacement test (section 9)
10775 !! options
10776 replace=9,"xxx"
10777 !! input
10778 start
10779 ==a==
10780 ===aa===
10781 ====aaa====
10782 ==b==
10783 ===ba===
10784 ===bb===
10785 ====bba====
10786 ===bc===
10787 ==c==
10788 ===ca===
10789 !! result
10790 start
10791 ==a==
10792 ===aa===
10793 ====aaa====
10794 ==b==
10795 ===ba===
10796 ===bb===
10797 ====bba====
10798 ===bc===
10799 xxx
10800 !! end
10801
10802 !! test
10803 Section replacement test (section 10)
10804 !! options
10805 replace=10,"xxx"
10806 !! input
10807 start
10808 ==a==
10809 ===aa===
10810 ====aaa====
10811 ==b==
10812 ===ba===
10813 ===bb===
10814 ====bba====
10815 ===bc===
10816 ==c==
10817 ===ca===
10818 !! result
10819 start
10820 ==a==
10821 ===aa===
10822 ====aaa====
10823 ==b==
10824 ===ba===
10825 ===bb===
10826 ====bba====
10827 ===bc===
10828 ==c==
10829 xxx
10830 !! end
10831
10832 !! test
10833 Section replacement test with initial whitespace (bug 13728)
10834 !! options
10835 replace=2,"xxx"
10836 !! input
10837 Preformatted initial line
10838 ==a==
10839 ===a===
10840 !! result
10841 Preformatted initial line
10842 ==a==
10843 xxx
10844 !! end
10845
10846
10847 !! test
10848 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10849 !! options
10850 section=1
10851 !! input
10852 ==a==
10853 a
10854 !! result
10855 ==a==
10856 a
10857 !! end
10858
10859 !! test
10860 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10861 !! options
10862 section=1
10863 !! input
10864 ==a==
10865 a
10866 !! result
10867 ==a==
10868 a
10869 !! end
10870
10871
10872 !! test
10873 Section extraction, <pre> around bogus header (bug 10309)
10874 !! options
10875 noxml section=2
10876 !! input
10877 == Section One ==
10878 <pre>
10879 =======
10880 </pre>
10881
10882 == Section Two ==
10883 stuff
10884 !! result
10885 == Section Two ==
10886 stuff
10887 !! end
10888
10889 !! test
10890 Section replacement, <pre> around bogus header (bug 10309)
10891 !! options
10892 noxml replace=2,"xxx"
10893 !! input
10894 == Section One ==
10895 <pre>
10896 =======
10897 </pre>
10898
10899 == Section Two ==
10900 stuff
10901 !! result
10902 == Section One ==
10903 <pre>
10904 =======
10905 </pre>
10906
10907 xxx
10908 !! end
10909
10910
10911
10912 !! test
10913 Handling of &#x0A; in URLs
10914 !! input
10915 **irc://&#x0A;a
10916 !! result
10917 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10918 </li></ul>
10919 </li></ul>
10920
10921 !!end
10922
10923 !! test
10924 5 quotes, code coverage +1 line (php)
10925 !! options
10926 php
10927 !! input
10928 '''''
10929 !! result
10930 !! end
10931 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
10932 !! test
10933 5 quotes, code coverage +1 line (parsoid)
10934 !! options
10935 parsoid
10936 !! input
10937 '''''
10938 !! result
10939 <p><i><b></b></i></p>
10940 !! end
10941
10942 !! test
10943 Special:Search page linking.
10944 !! input
10945 {{Special:search}}
10946 !! result
10947 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10948 </p>
10949 !! end
10950
10951 !! test
10952 Say the magic word
10953 !! input
10954 * {{PAGENAME}}
10955 * {{BASEPAGENAME}}
10956 * {{SUBPAGENAME}}
10957 * {{SUBPAGENAMEE}}
10958 * {{ROOTPAGENAME}}
10959 * {{ROOTPAGENAMEE}}
10960 * {{BASEPAGENAME}}
10961 * {{BASEPAGENAMEE}}
10962 * {{TALKPAGENAME}}
10963 * {{TALKPAGENAMEE}}
10964 * {{SUBJECTPAGENAME}}
10965 * {{SUBJECTPAGENAMEE}}
10966 * {{NAMESPACEE}}
10967 * {{NAMESPACE}}
10968 * {{TALKSPACE}}
10969 * {{TALKSPACEE}}
10970 * {{SUBJECTSPACE}}
10971 * {{SUBJECTSPACEE}}
10972 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10973 !! result
10974 <ul><li> Parser test
10975 </li><li> Parser test
10976 </li><li> Parser test
10977 </li><li> Parser_test
10978 </li><li> Parser test
10979 </li><li> Parser_test
10980 </li><li> Parser test
10981 </li><li> Parser_test
10982 </li><li> Talk:Parser test
10983 </li><li> Talk:Parser_test
10984 </li><li> Parser test
10985 </li><li> Parser_test
10986 </li><li>
10987 </li><li>
10988 </li><li> Talk
10989 </li><li> Talk
10990 </li><li>
10991 </li><li>
10992 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
10993 </li></ul>
10994
10995 !! end
10996 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10997
10998 !! test
10999 Gallery
11000 !! input
11001 <gallery>
11002 image1.png |
11003 image2.gif|||||
11004
11005 image3|
11006 image4 |300px| centre
11007 image5.svg| http://///////
11008 [[x|xx]]]]
11009 * image6
11010 </gallery>
11011 !! result
11012 <ul class="gallery">
11013 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11014 <div style="height: 150px;">Image1.png</div>
11015 <div class="gallerytext">
11016 </div>
11017 </div></li>
11018 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11019 <div style="height: 150px;">Image2.gif</div>
11020 <div class="gallerytext">
11021 <p>||||
11022 </p>
11023 </div>
11024 </div></li>
11025 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11026 <div style="height: 150px;">Image3</div>
11027 <div class="gallerytext">
11028 </div>
11029 </div></li>
11030 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11031 <div style="height: 150px;">Image4</div>
11032 <div class="gallerytext">
11033 <p>300px| centre
11034 </p>
11035 </div>
11036 </div></li>
11037 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11038 <div style="height: 150px;">Image5.svg</div>
11039 <div class="gallerytext">
11040 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11041 </p>
11042 </div>
11043 </div></li>
11044 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11045 <div style="height: 150px;">* image6</div>
11046 <div class="gallerytext">
11047 </div>
11048 </div></li>
11049 </ul>
11050
11051 !! end
11052
11053 !! test
11054 Gallery (with options)
11055 !! input
11056 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11057 File:Nonexistant.jpg|caption
11058 File:Nonexistant.jpg
11059 image:foobar.jpg|some '''caption''' [[Main Page]]
11060 image:foobar.jpg
11061 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11062 </gallery>
11063 !! result
11064 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11065 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11066 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11067 <div style="height: 70px;">Nonexistant.jpg</div>
11068 <div class="gallerytext">
11069 <p>caption
11070 </p>
11071 </div>
11072 </div></li>
11073 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11074 <div style="height: 70px;">Nonexistant.jpg</div>
11075 <div class="gallerytext">
11076 </div>
11077 </div></li>
11078 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11079 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11080 <div class="gallerytext">
11081 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11082 </p>
11083 </div>
11084 </div></li>
11085 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11086 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11087 <div class="gallerytext">
11088 </div>
11089 </div></li>
11090 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11091 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11092 <div class="gallerytext">
11093 <p>Blabla|blabla.
11094 </p>
11095 </div>
11096 </div></li>
11097 </ul>
11098
11099 !! end
11100
11101 !! test
11102 Gallery with wikitext inside caption
11103 !! input
11104 <gallery>
11105 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11106 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11107 </gallery>
11108 !! result
11109 <ul class="gallery">
11110 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11111 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11112 <div class="gallerytext">
11113 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
11114 </p>
11115 </div>
11116 </div></li>
11117 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11118 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11119 <div class="gallerytext">
11120 <p>This is a test template
11121 </p>
11122 </div>
11123 </div></li>
11124 </ul>
11125
11126 !! end
11127
11128 !! test
11129 gallery (with showfilename option)
11130 !! input
11131 <gallery showfilename>
11132 File:Nonexistant.jpg|caption
11133 File:Nonexistant.jpg
11134 image:foobar.jpg|some '''caption''' [[Main Page]]
11135 File:Foobar.jpg
11136 </gallery>
11137 !! result
11138 <ul class="gallery">
11139 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11140 <div style="height: 150px;">Nonexistant.jpg</div>
11141 <div class="gallerytext">
11142 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11143 caption
11144 </p>
11145 </div>
11146 </div></li>
11147 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11148 <div style="height: 150px;">Nonexistant.jpg</div>
11149 <div class="gallerytext">
11150 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11151 </p>
11152 </div>
11153 </div></li>
11154 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11155 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11156 <div class="gallerytext">
11157 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11158 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11159 </p>
11160 </div>
11161 </div></li>
11162 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11163 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11164 <div class="gallerytext">
11165 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11166 </p>
11167 </div>
11168 </div></li>
11169 </ul>
11170
11171 !! end
11172
11173 !! test
11174 Gallery (with namespace-less filenames)
11175 !! input
11176 <gallery>
11177 File:Nonexistant.jpg
11178 Nonexistant.jpg
11179 image:foobar.jpg
11180 foobar.jpg
11181 </gallery>
11182 !! result
11183 <ul class="gallery">
11184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11185 <div style="height: 150px;">Nonexistant.jpg</div>
11186 <div class="gallerytext">
11187 </div>
11188 </div></li>
11189 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11190 <div style="height: 150px;">Nonexistant.jpg</div>
11191 <div class="gallerytext">
11192 </div>
11193 </div></li>
11194 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11195 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11196 <div class="gallerytext">
11197 </div>
11198 </div></li>
11199 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11200 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11201 <div class="gallerytext">
11202 </div>
11203 </div></li>
11204 </ul>
11205
11206 !! end
11207
11208 !! test
11209 HTML Hex character encoding (spells the word "JavaScript")
11210 !! input
11211 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11212 !! result
11213 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11214 </p>
11215 !! end
11216
11217 !! test
11218 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11219 !! input
11220 &#xsee;&#XSEE;
11221 !! result
11222 <p>&amp;#xsee;&amp;#XSEE;
11223 </p>
11224 !! end
11225
11226 !! test
11227 HTML Hex character encoding mixed case
11228 !! input
11229 &#xEE;&#Xee;
11230 !! result
11231 <p>&#xee;&#xee;
11232 </p>
11233 !! end
11234
11235 !! test
11236 __FORCETOC__ override
11237 !! input
11238 __NEWSECTIONLINK__
11239 __FORCETOC__
11240 !! result
11241 <p><br />
11242 </p>
11243 !! end
11244
11245 !! test
11246 ISBN code coverage
11247 !! input
11248 ISBN 978-0-1234-56&#x20;789
11249 !! result
11250 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11251 </p>
11252 !! end
11253
11254 !! test
11255 ISBN followed by 5 spaces
11256 !! input
11257 ISBN
11258 !! result
11259 <p>ISBN
11260 </p>
11261 !! end
11262
11263 !! test
11264 Double ISBN
11265 !! input
11266 ISBN ISBN 1234567890
11267 !! result
11268 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11269 </p>
11270 !! end
11271
11272 !! test
11273 Bug 22905: <abbr> followed by ISBN followed by </a>
11274 !! input
11275 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11276 !! result
11277 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
11278 </p>
11279 !! end
11280
11281 !! test
11282 Double RFC
11283 !! input
11284 RFC RFC 1234
11285 !! result
11286 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11287 </p>
11288 !! end
11289
11290 !! test
11291 Double RFC with a wiki link
11292 !! input
11293 RFC [[RFC 1234]]
11294 !! result
11295 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
11296 </p>
11297 !! end
11298
11299 !! test
11300 RFC code coverage
11301 !! input
11302 RFC 983&#x20;987
11303 !! result
11304 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11305 </p>
11306 !! end
11307
11308 !! test
11309 Centre-aligned image
11310 !! input
11311 [[Image:foobar.jpg|centre]]
11312 !! result
11313 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
11314
11315 !!end
11316
11317 !! test
11318 None-aligned image
11319 !! input
11320 [[Image:foobar.jpg|none]]
11321 !! result
11322 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11323
11324 !!end
11325
11326 !! test
11327 Width + Height sized image (using px) (height is ignored)
11328 !! input
11329 [[Image:foobar.jpg|640x480px]]
11330 !! result
11331 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11332 </p>
11333 !!end
11334
11335 !! test
11336 Width-sized image (using px, no following whitespace)
11337 !! input
11338 [[Image:foobar.jpg|640px]]
11339 !! result
11340 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11341 </p>
11342 !!end
11343
11344 !! test
11345 Width-sized image (using px, with following whitespace - test regression from r39467)
11346 !! input
11347 [[Image:foobar.jpg|640px ]]
11348 !! result
11349 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11350 </p>
11351 !!end
11352
11353 !! test
11354 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11355 !! input
11356 [[Image:foobar.jpg| 640px]]
11357 !! result
11358 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11359 </p>
11360 !!end
11361
11362 !! test
11363 Another italics / bold test
11364 !! input
11365 ''' ''x'
11366 !! result
11367 <pre>'<i> </i>x'
11368 </pre>
11369 !!end
11370
11371 # Note the results may be incorrect, as parserTest output included this:
11372 # XML error: Mismatched tag at byte 6120:
11373 # ...<dd> </dt></dl> </dd...
11374 !! test
11375 dt/dd/dl test
11376 !! options
11377 disabled
11378 !! input
11379 :;;;::
11380 !! result
11381 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11382 </dd></dl>
11383 </dd></dl>
11384 </dt></dl>
11385 </dt></dl>
11386 </dt></dl>
11387 </dd></dl>
11388
11389 !!end
11390
11391
11392 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11393 !! test
11394 Images with the "|" character in the comment
11395 !! input
11396 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11397 !! result
11398 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
11399
11400 !!end
11401
11402 !! test
11403 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11404 !! input
11405 <html><script>alert(1);</script></html>
11406 !! result
11407 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11408 </p>
11409 !! end
11410
11411 !! test
11412 HTML with raw HTML ($wgRawHtml==true)
11413 !! options
11414 rawhtml
11415 !! input
11416 <html><script>alert(1);</script></html>
11417 !! result
11418 <p><script>alert(1);</script>
11419 </p>
11420 !! end
11421
11422 !! test
11423 Parents of subpages, one level up
11424 !! options
11425 subpage title=[[Subpage test/L1/L2/L3]]
11426 !! input
11427 [[../|L2]]
11428 !! result
11429 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
11430 </p>
11431 !! end
11432
11433
11434 !! test
11435 Parents of subpages, one level up, not named
11436 !! options
11437 subpage title=[[Subpage test/L1/L2/L3]]
11438 !! input
11439 [[../]]
11440 !! result
11441 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
11442 </p>
11443 !! end
11444
11445
11446
11447 !! test
11448 Parents of subpages, two levels up
11449 !! options
11450 subpage title=[[Subpage test/L1/L2/L3]]
11451 !! input
11452 [[../../|L1]]2
11453
11454 [[../../|L1]]l
11455 !! result
11456 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
11457 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
11458 </p>
11459 !! end
11460
11461 !! test
11462 Parents of subpages, two levels up, without trailing slash or name.
11463 !! options
11464 subpage title=[[Subpage test/L1/L2/L3]]
11465 !! input
11466 [[../..]]
11467 !! result
11468 <p>[[../..]]
11469 </p>
11470 !! end
11471
11472 !! test
11473 Parents of subpages, two levels up, with lots of extra trailing slashes.
11474 !! options
11475 subpage title=[[Subpage test/L1/L2/L3]]
11476 !! input
11477 [[../../////]]
11478 !! result
11479 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
11480 </p>
11481 !! end
11482
11483 !! test
11484 Definition list code coverage
11485 !! input
11486 ; title : def
11487 ; title : def
11488 ;title: def
11489 !! result
11490 <dl><dt> title &#160;</dt><dd> def
11491 </dd><dt> title&#160;</dt><dd> def
11492 </dd><dt>title</dt><dd> def
11493 </dd></dl>
11494
11495 !! end
11496
11497 !! test
11498 Don't fall for the self-closing div
11499 !! input
11500 <div>hello world</div/>
11501 !! result
11502 <div>hello world</div>
11503
11504 !! end
11505
11506 !! test
11507 MSGNW magic word
11508 !! input
11509 {{MSGNW:msg}}
11510 !! result
11511 <p>&#91;&#91;:Template:Msg&#93;&#93;
11512 </p>
11513 !! end
11514
11515 !! test
11516 RAW magic word
11517 !! input
11518 {{RAW:QUERTY}}
11519 !! result
11520 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
11521 </p>
11522 !! end
11523
11524 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11525 !! test
11526 Always escape literal '>' in output, not just after '<'
11527 !! input
11528 ><>
11529 !! result
11530 <p>&gt;&lt;&gt;
11531 </p>
11532 !! end
11533
11534 !! test
11535 Template caching
11536 !! input
11537 {{Test}}
11538 {{Test}}
11539 !! result
11540 <p>This is a test template
11541 This is a test template
11542 </p>
11543 !! end
11544
11545
11546 !! article
11547 MediaWiki:Fake
11548 !! text
11549 ==header==
11550 !! endarticle
11551
11552 !! test
11553 Inclusion of !userCanEdit() content
11554 !! input
11555 {{MediaWiki:Fake}}
11556 !! result
11557 <h2><span class="editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline" id="header">header</span></h2>
11558
11559 !! end
11560
11561
11562 !! test
11563 Out-of-order TOC heading levels
11564 !! input
11565 ==2==
11566 ======6======
11567 ===3===
11568 =1=
11569 =====5=====
11570 ==2==
11571 !! result
11572 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11573 <ul>
11574 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11575 <ul>
11576 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11577 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11578 </ul>
11579 </li>
11580 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11581 <ul>
11582 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11583 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11584 </ul>
11585 </li>
11586 </ul>
11587 </td></tr></table>
11588 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2">2</span></h2>
11589 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline" id="6">6</span></h6>
11590 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline" id="3">3</span></h3>
11591 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline" id="1">1</span></h1>
11592 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline" id="5">5</span></h5>
11593 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2_2">2</span></h2>
11594
11595 !! end
11596
11597
11598 !! test
11599 ISBN with a dummy number
11600 !! input
11601 ISBN ---
11602 !! result
11603 <p>ISBN ---
11604 </p>
11605 !! end
11606
11607
11608 !! test
11609 ISBN with space-delimited number
11610 !! input
11611 ISBN 92 9017 032 8
11612 !! result
11613 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11614 </p>
11615 !! end
11616
11617
11618 !! test
11619 ISBN with multiple spaces, no number
11620 !! input
11621 ISBN foo
11622 !! result
11623 <p>ISBN foo
11624 </p>
11625 !! end
11626
11627
11628 !! test
11629 ISBN length
11630 !! input
11631 ISBN 123456789
11632
11633 ISBN 1234567890
11634
11635 ISBN 12345678901
11636 !! result
11637 <p>ISBN 123456789
11638 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11639 </p><p>ISBN 12345678901
11640 </p>
11641 !! end
11642
11643
11644 !! test
11645 ISBN with trailing year (bug 8110)
11646 !! input
11647 ISBN 1-234-56789-0 - 2006
11648
11649 ISBN 1 234 56789 0 - 2006
11650 !! result
11651 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11652 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11653 </p>
11654 !! end
11655
11656
11657 !! test
11658 anchorencode
11659 !! input
11660 {{anchorencode:foo bar©#%n}}
11661 !! result
11662 <p>foo_bar.C2.A9.23.25n
11663 </p>
11664 !! end
11665
11666 !! test
11667 anchorencode trims spaces
11668 !! input
11669 {{anchorencode: __pretty__please__}}
11670 !! result
11671 <p>pretty_please
11672 </p>
11673 !! end
11674
11675 !! test
11676 anchorencode deals with links
11677 !! input
11678 {{anchorencode: [[hello|world]] [[hi]]}}
11679 !! result
11680 <p>world_hi
11681 </p>
11682 !! end
11683
11684 !! test
11685 anchorencode deals with templates
11686 !! input
11687 {{anchorencode: {{Foo}} }}
11688 !! result
11689 <p>FOO
11690 </p>
11691 !! end
11692
11693 !! test
11694 anchorencode encodes like the TOC generator: (bug 18431)
11695 !! input
11696 === _ +:.3A%3A&&amp;]] ===
11697 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11698 __NOEDITSECTION__
11699 !! result
11700 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11701 <p>.2B:.3A.253A.26.26.5D.5D
11702 </p>
11703 !! end
11704
11705 # Expected output in the following test is not necessarily expected (there
11706 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11707 # only testing for well-formedness.
11708 !! test
11709 Bug 6200: blockquotes and paragraph formatting
11710 !! input
11711 <blockquote>
11712 foo
11713 </blockquote>
11714
11715 bar
11716
11717 baz
11718 !! result
11719 <blockquote>
11720 foo
11721 </blockquote>
11722 <p>bar
11723 </p>
11724 <pre>baz
11725 </pre>
11726 !! end
11727
11728 !! test
11729 Bug 8293: Use of center tag ruins paragraph formatting
11730 !! input
11731 <center>
11732 foo
11733 </center>
11734
11735 bar
11736
11737 baz
11738 !! result
11739 <center>
11740 <p>foo
11741 </p>
11742 </center>
11743 <p>bar
11744 </p>
11745 <pre>baz
11746 </pre>
11747 !! end
11748
11749 !!test
11750 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
11751 !!options
11752 php
11753 !!input
11754 <span><s>x</span></s>
11755 !!result
11756 <p><span><s>x&lt;/span&gt;</s></span>
11757 </p>
11758 !!end
11759
11760 !!test
11761 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
11762 !!options
11763 parsoid
11764 !!input
11765 <span><s>x</span></s>
11766 !!result
11767 <p><span><s>x</s></span><s></s>
11768 </p>
11769 !!end
11770
11771 ###
11772 ### Language variants related tests
11773 ###
11774 !! test
11775 Self-link in language variants
11776 !! options
11777 title=[[Dunav]] language=sr
11778 !! input
11779 Both [[Dunav]] and [[Дунав]] are names for this river.
11780 !! result
11781 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11782 </p>
11783 !!end
11784
11785 !! article
11786 Дуна
11787 !! text
11788 content
11789 !! endarticle
11790
11791 !! test
11792 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11793 !! options
11794 title=[[Duna]] language=sr
11795 !! input
11796 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11797 !! result
11798 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
11799 </p>
11800 !! end
11801
11802 !! test
11803 Link to pages in language variants
11804 !! options
11805 language=sr
11806 !! input
11807 Main Page can be written as [[Маин Паге]]
11808 !! result
11809 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11810 </p>
11811 !!end
11812
11813
11814 !! test
11815 Multiple links to pages in language variants
11816 !! options
11817 language=sr
11818 !! input
11819 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11820 !! result
11821 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
11822 </p>
11823 !!end
11824
11825
11826 !! test
11827 Simple template in language variants
11828 !! options
11829 language=sr
11830 !! input
11831 {{тест}}
11832 !! result
11833 <p>This is a test template
11834 </p>
11835 !! end
11836
11837
11838 !! test
11839 Template with explicit namespace in language variants
11840 !! options
11841 language=sr
11842 !! input
11843 {{Template:тест}}
11844 !! result
11845 <p>This is a test template
11846 </p>
11847 !! end
11848
11849
11850 !! test
11851 Basic test for template parameter in language variants
11852 !! options
11853 language=sr
11854 !! input
11855 {{парамтест|param=foo}}
11856 !! result
11857 <p>This is a test template with parameter foo
11858 </p>
11859 !! end
11860
11861
11862 !! test
11863 Simple category in language variants
11864 !! options
11865 language=sr cat
11866 !! input
11867 [[Category:МедиаWики Усер'с Гуиде]]
11868 !! result
11869 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
11870 !! end
11871
11872
11873 !! article
11874 Category:分类
11875 !! text
11876 blah
11877 !! endarticle
11878
11879 !! article
11880 Category:分類
11881 !! text
11882 blah
11883 !! endarticle
11884
11885 !! test
11886 Don't convert blue categorylinks to another variant (bug 33210)
11887 !! options
11888 language=zh cat
11889 !! input
11890 [[A]][[Category:分类]]
11891 !! result
11892 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11893 !! end
11894
11895
11896 !! test
11897 Stripping -{}- tags (language variants)
11898 !! options
11899 language=sr
11900 !! input
11901 Latin proverb: -{Ne nuntium necare}-
11902 !! result
11903 <p>Latin proverb: Ne nuntium necare
11904 </p>
11905 !! end
11906
11907
11908 !! test
11909 Prevent conversion with -{}- tags (language variants)
11910 !! options
11911 language=sr variant=sr-ec
11912 !! input
11913 Latinski: -{Ne nuntium necare}-
11914 !! result
11915 <p>Латински: Ne nuntium necare
11916 </p>
11917 !! end
11918
11919
11920 !! test
11921 Prevent conversion of text with -{}- tags (language variants)
11922 !! options
11923 language=sr variant=sr-ec
11924 !! input
11925 Latinski: -{Ne nuntium necare}-
11926 !! result
11927 <p>Латински: Ne nuntium necare
11928 </p>
11929 !! end
11930
11931
11932 !! test
11933 Prevent conversion of links with -{}- tags (language variants)
11934 !! options
11935 language=sr variant=sr-ec
11936 !! input
11937 -{[[Main Page]]}-
11938 !! result
11939 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11940 </p>
11941 !! end
11942
11943
11944 !! test
11945 -{}- tags within headlines (within html for parserConvert())
11946 !! options
11947 language=sr variant=sr-ec
11948 !! input
11949 == -{Naslov}- ==
11950 !! result
11951 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span></h2>
11952
11953 !! end
11954
11955
11956 !! test
11957 Explicit definition of language variant alternatives
11958 !! options
11959 language=zh variant=zh-tw
11960 !! input
11961 -{zh:China;zh-tw:Taiwan}-, not China
11962 !! result
11963 <p>Taiwan, not China
11964 </p>
11965 !! end
11966
11967
11968 !! test
11969 Conversion around HTML tags
11970 !! options
11971 language=sr variant=sr-ec
11972 !! input
11973 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11974 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11975 !! result
11976 <p>
11977 <span title="ЛаCтин">ски</span>
11978 </p>
11979 !! end
11980
11981
11982 !! test
11983 Explicit session-wise language variant mapping (A flag and - flag)
11984 !! options
11985 language=zh variant=zh-tw
11986 !! input
11987 Taiwan is not China.
11988 But -{A|zh:China;zh-tw:Taiwan}- is China,
11989 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11990 and -{China}- is China.
11991 !! result
11992 <p>Taiwan is not China.
11993 But Taiwan is Taiwan,
11994 (This should be stripped!)
11995 and China is China.
11996 </p>
11997 !! end
11998
11999 !! test
12000 Explicit session-wise language variant mapping (H flag for hide)
12001 !! options
12002 language=zh variant=zh-tw
12003 !! input
12004 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12005 Taiwan is China.
12006 !! result
12007 <p>(This should be stripped!)
12008 Taiwan is Taiwan.
12009 </p>
12010 !! end
12011
12012 !! test
12013 Adding explicit conversion rule for title (T flag)
12014 !! options
12015 language=zh variant=zh-tw showtitle
12016 !! input
12017 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12018 !! result
12019 Taiwan
12020 <p>Should be stripped!
12021 </p>
12022 !! end
12023
12024 !! test
12025 Testing that changing the language variant here in the tests actually works
12026 !! options
12027 language=zh variant=zh showtitle
12028 !! input
12029 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12030 !! result
12031 China
12032 <p>Should be stripped!
12033 </p>
12034 !! end
12035
12036 !! test
12037 Recursive conversion of alt and title attrs shouldn't clear converter state
12038 !! options
12039 language=zh variant=zh-cn showtitle
12040 !! input
12041 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12042 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12043 !! result
12044 China
12045 <p>
12046 Should be stripped<span title="Exclamation">!</span>
12047 </p>
12048 !! end
12049
12050 !! test
12051 Bug 24072: more test on conversion rule for title
12052 !! options
12053 language=zh variant=zh-tw showtitle
12054 !! input
12055 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12056 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12057 !! result
12058 Taiwan
12059 <p>This should be stripped!
12060 This won't take interferes with the title rule.
12061 </p>
12062 !! end
12063
12064 !! test
12065 Raw output of variant escape tags (R flag)
12066 !! options
12067 language=zh variant=zh-tw
12068 !! input
12069 Raw: -{R|zh:China;zh-tw:Taiwan}-
12070 !! result
12071 <p>Raw: zh:China;zh-tw:Taiwan
12072 </p>
12073 !! end
12074
12075 !! test
12076 Nested using of manual convert syntax
12077 !! options
12078 language=zh variant=zh-hk
12079 !! input
12080 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12081 !! result
12082 <p>Nested: Hello Hong Kong!
12083 </p>
12084 !! end
12085
12086 !! test
12087 Proper conversion of text in external links
12088 !! options
12089 language=sr variant=sr-ec
12090 !! input
12091 http://www.google.com
12092 gopher://www.google.com
12093 [http://www.google.com http://www.google.com]
12094 [gopher://www.google.com gopher://www.google.com]
12095 [https://www.google.com irc://www.google.com]
12096 [ftp://www.google.com www.google.com/ftp://dir]
12097 [//www.google.com www.google.com]
12098 !! result
12099 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12100 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12101 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12102 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12103 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12104 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12105 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12106 </p>
12107 !! end
12108
12109 !! test
12110 Do not convert roman numbers to language variants
12111 !! options
12112 language=sr variant=sr-ec
12113 !! input
12114 Fridrih IV je car.
12115 !! result
12116 <p>Фридрих IV је цар.
12117 </p>
12118 !! end
12119
12120 !! test
12121 Unclosed language converter markup "-{"
12122 !! options
12123 language=sr
12124 !! input
12125 -{T|hello
12126 !! result
12127 <p>-{T|hello
12128 </p>
12129 !! end
12130
12131 !! test
12132 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12133 !! options
12134 language=sr
12135 !! input
12136 -{R|=&gt;}-
12137 !! result
12138 <p>=&gt;
12139 </p>
12140 !!end
12141
12142 !!article
12143 Template:Bullet
12144 !!text
12145 * Bar
12146 !!endarticle
12147
12148 !! test
12149 Bug 529: Uncovered bullet
12150 !! input
12151 * Foo {{bullet}}
12152 !! result
12153 <ul><li> Foo
12154 </li><li> Bar
12155 </li></ul>
12156
12157 !! end
12158
12159 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12160 # Templates in Wikipedia rely on this behavior, as tidy has always been
12161 # enabled there. These tests are normally run *without* tidy, so specify the
12162 # full output here.
12163 # To test realistic parsing behavior, apply a tidy-like transformation to both
12164 # the expected output and your parser's output.
12165 !! test
12166 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12167 !! input
12168 ******* Foo {{bullet}}
12169 !! result
12170 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12171 </li></ul>
12172 </li></ul>
12173 </li></ul>
12174 </li></ul>
12175 </li></ul>
12176 </li></ul>
12177 </li><li> Bar
12178 </li></ul>
12179
12180 !! end
12181
12182 !! test
12183 Bug 529: Uncovered table already at line-start
12184 !! input
12185 x
12186
12187 {{table}}
12188 y
12189 !! result
12190 <p>x
12191 </p>
12192 <table>
12193 <tr>
12194 <td> 1 </td>
12195 <td> 2
12196 </td></tr>
12197 <tr>
12198 <td> 3 </td>
12199 <td> 4
12200 </td></tr></table>
12201 <p>y
12202 </p>
12203 !! end
12204
12205 !! test
12206 Bug 529: Uncovered bullet in parser function result
12207 !! input
12208 * Foo {{lc:{{bullet}} }}
12209 !! result
12210 <ul><li> Foo
12211 </li><li> bar
12212 </li></ul>
12213
12214 !! end
12215
12216 !! test
12217 Bug 5678: Double-parsed template argument
12218 !! input
12219 {{lc:{{{1}}}|hello}}
12220 !! result
12221 <p>{{{1}}}
12222 </p>
12223 !! end
12224
12225 !! test
12226 Bug 5678: Double-parsed template invocation
12227 !! input
12228 {{lc:{{paramtest {{!}} param = hello }} }}
12229 !! result
12230 <p>{{paramtest | param = hello }}
12231 </p>
12232 !! end
12233
12234 !! test
12235 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12236 !! options
12237 language=cs
12238 title=[[Main Page]]
12239 !! input
12240 {{PRVNÍVELKÉ:ěščř}}
12241 {{prvnívelké:ěščř}}
12242 {{PRVNÍMALÉ:ěščř}}
12243 {{prvnímalé:ěščř}}
12244 {{MALÁ:ěščř}}
12245 {{malá:ěščř}}
12246 {{VELKÁ:ěščř}}
12247 {{velká:ěščř}}
12248 !! result
12249 <p>Ěščř
12250 Ěščř
12251 ěščř
12252 ěščř
12253 ěščř
12254 ěščř
12255 ĚŠČŘ
12256 ĚŠČŘ
12257 </p>
12258 !! end
12259
12260 !! test
12261 Morwen/13: Unclosed link followed by heading
12262 !! input
12263 [[link
12264 ==heading==
12265 !! result
12266 <p>[[link
12267 </p>
12268 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
12269
12270 !! end
12271
12272 !! test
12273 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12274 !! input
12275 {{foo|
12276 =heading=
12277 !! result
12278 <p>{{foo|
12279 </p>
12280 <h1> <span class="mw-headline" id="heading">heading</span></h1>
12281
12282 !! end
12283
12284 !! test
12285 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12286 !! input
12287 {{foo|
12288 ==heading==
12289 !! result
12290 <p>{{foo|
12291 </p>
12292 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
12293
12294 !! end
12295
12296 !! test
12297 Tildes in comments
12298 !! options
12299 pst
12300 !! input
12301 <!-- ~~~~ -->
12302 !! result
12303 <!-- ~~~~ -->
12304 !! end
12305
12306 !! test
12307 Paragraphs inside divs (no extra line breaks)
12308 !! input
12309 <div>Line one
12310
12311 Line two</div>
12312 !! result
12313 <div>Line one
12314 Line two</div>
12315
12316 !! end
12317
12318 !! test
12319 Paragraphs inside divs (extra line break on open)
12320 !! input
12321 <div>
12322 Line one
12323
12324 Line two</div>
12325 !! result
12326 <div>
12327 <p>Line one
12328 </p>
12329 Line two</div>
12330
12331 !! end
12332
12333 !! test
12334 Paragraphs inside divs (extra line break on close)
12335 !! input
12336 <div>Line one
12337
12338 Line two
12339 </div>
12340 !! result
12341 <div>Line one
12342 <p>Line two
12343 </p>
12344 </div>
12345
12346 !! end
12347
12348 !! test
12349 Paragraphs inside divs (extra line break on open and close)
12350 !! input
12351 <div>
12352 Line one
12353
12354 Line two
12355 </div>
12356 !! result
12357 <div>
12358 <p>Line one
12359 </p><p>Line two
12360 </p>
12361 </div>
12362
12363 !! end
12364
12365 !! test
12366 Nesting tags, paragraphs on lines which begin with <div>
12367 !! options
12368 disabled
12369 !! input
12370 <div></div><strong>A
12371 B</strong>
12372 !! result
12373 <div></div>
12374 <p><strong>A
12375 B</strong>
12376 </p>
12377 !! end
12378
12379 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12380 !! test
12381 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12382 !! options
12383 disabled
12384 !! input
12385 <blockquote>Line one
12386
12387 Line two</blockquote>
12388 !! result
12389 <blockquote>Line one
12390 Line two</blockquote>
12391
12392 !! end
12393
12394 !! test
12395 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12396 !! options
12397 disabled
12398 !! input
12399 <blockquote>
12400 Line one
12401
12402 Line two</blockquote>
12403 !! result
12404 <blockquote>
12405 <p>Line one
12406 </p>
12407 Line two</blockquote>
12408
12409 !! end
12410
12411 !! test
12412 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12413 !! options
12414 disabled
12415 !! input
12416 <blockquote>Line one
12417
12418 Line two
12419 </blockquote>
12420 !! result
12421 <blockquote>Line one
12422 <p>Line two
12423 </p>
12424 </blockquote>
12425
12426 !! end
12427
12428 !! test
12429 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12430 !! options
12431 disabled
12432 !! input
12433 <blockquote>
12434 Line one
12435
12436 Line two
12437 </blockquote>
12438 !! result
12439 <blockquote>
12440 <p>Line one
12441 </p><p>Line two
12442 </p>
12443 </blockquote>
12444
12445 !! end
12446
12447 !! test
12448 Paragraphs inside blockquotes/divs (no extra line breaks)
12449 !! input
12450 <blockquote><div>Line one
12451
12452 Line two</div></blockquote>
12453 !! result
12454 <blockquote><div>Line one
12455 Line two</div></blockquote>
12456
12457 !! end
12458
12459 !! test
12460 Paragraphs inside blockquotes/divs (extra line break on open)
12461 !! input
12462 <blockquote><div>
12463 Line one
12464
12465 Line two</div></blockquote>
12466 !! result
12467 <blockquote><div>
12468 <p>Line one
12469 </p>
12470 Line two</div></blockquote>
12471
12472 !! end
12473
12474 !! test
12475 Paragraphs inside blockquotes/divs (extra line break on close)
12476 !! input
12477 <blockquote><div>Line one
12478
12479 Line two
12480 </div></blockquote>
12481 !! result
12482 <blockquote><div>Line one
12483 <p>Line two
12484 </p>
12485 </div></blockquote>
12486
12487 !! end
12488
12489 !! test
12490 Paragraphs inside blockquotes/divs (extra line break on open and close)
12491 !! input
12492 <blockquote><div>
12493 Line one
12494
12495 Line two
12496 </div></blockquote>
12497 !! result
12498 <blockquote><div>
12499 <p>Line one
12500 </p><p>Line two
12501 </p>
12502 </div></blockquote>
12503
12504 !! end
12505
12506 !! test
12507 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12508 !! options
12509 wgLinkHolderBatchSize=0
12510 !! input
12511 [[meatball:1]]
12512 [[meatball:2]]
12513 [[meatball:3]]
12514 !! result
12515 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12516 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12517 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12518 </p>
12519 !! end
12520
12521 !! test
12522 Free external link invading image caption
12523 !! input
12524 [[Image:Foobar.jpg|thumb|http://x|hello]]
12525 !! result
12526 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
12527
12528 !! end
12529
12530 !! test
12531 Bug 15196: localised external link numbers
12532 !! options
12533 language=fa
12534 !! input
12535 [http://en.wikipedia.org/]
12536 !! result
12537 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12538 </p>
12539 !! end
12540
12541 !! test
12542 Multibyte character in padleft
12543 !! input
12544 {{padleft:-Hello|7|Æ}}
12545 !! result
12546 <p>Æ-Hello
12547 </p>
12548 !! end
12549
12550 !! test
12551 Multibyte character in padright
12552 !! input
12553 {{padright:Hello-|7|Æ}}
12554 !! result
12555 <p>Hello-Æ
12556 </p>
12557 !! end
12558
12559 !!test
12560 formatdate parser function
12561 !!input
12562 {{#formatdate:2009-03-24}}
12563 !! result
12564 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12565 </p>
12566 !! end
12567
12568 !!test
12569 formatdate parser function, with default format
12570 !!input
12571 {{#formatdate:2009-03-24|mdy}}
12572 !! result
12573 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12574 </p>
12575 !! end
12576
12577 !! test
12578 Spacing of numbers in formatted dates
12579 !! input
12580 {{#formatdate:January 15}}
12581 !! result
12582 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12583 </p>
12584 !! end
12585
12586 !! test
12587 formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
12588 !! options
12589 language=nl title=[[MediaWiki:Common.css]]
12590 !! input
12591 {{#formatdate:2009-03-24|dmy}}
12592 !! result
12593 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12594 </p>
12595 !! end
12596
12597 #
12598 #
12599 #
12600
12601 #
12602 # Edit comments
12603 #
12604
12605 !! test
12606 Edit comment with link
12607 !! options
12608 comment
12609 !! input
12610 I like the [[Main Page]] a lot
12611 !! result
12612 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12613 !!end
12614
12615 !! test
12616 Edit comment with link and link text
12617 !! options
12618 comment
12619 !! input
12620 I like the [[Main Page|best pages]] a lot
12621 !! result
12622 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12623 !!end
12624
12625 !! test
12626 Edit comment with link and link text with suffix
12627 !! options
12628 comment
12629 !! input
12630 I like the [[Main Page|best page]]s a lot
12631 !! result
12632 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12633 !!end
12634
12635 !! test
12636 Edit comment with section link (non-local, eg in history list)
12637 !! options
12638 comment title=[[Main Page]]
12639 !! input
12640 /* External links */ removed bogus entries
12641 !! result
12642 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12643 !!end
12644
12645 !! test
12646 Edit comment with section link and text before it (non-local, eg in history list)
12647 !! options
12648 comment title=[[Main Page]]
12649 !! input
12650 pre-comment text /* External links */ removed bogus entries
12651 !! result
12652 pre-comment text - <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12653 !!end
12654
12655 !! test
12656 Edit comment with section link (local, eg in diff view)
12657 !! options
12658 comment local title=[[Main Page]]
12659 !! input
12660 /* External links */ removed bogus entries
12661 !! result
12662 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12663 !!end
12664
12665 !! test
12666 Edit comment with subpage link (bug 14080)
12667 !! options
12668 comment
12669 subpage
12670 title=[[Subpage test]]
12671 !! input
12672 Poked at a [[/subpage]] here...
12673 !! result
12674 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12675 !!end
12676
12677 !! test
12678 Edit comment with subpage link and link text (bug 14080)
12679 !! options
12680 comment
12681 subpage
12682 title=[[Subpage test]]
12683 !! input
12684 Poked at a [[/subpage|neat little page]] here...
12685 !! result
12686 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12687 !!end
12688
12689 !! test
12690 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12691 !! options
12692 comment
12693 title=[[Subpage test]]
12694 !! input
12695 Poked at a [[/subpage]] here...
12696 !! result
12697 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
12698 !!end
12699
12700 !! test
12701 Edit comment with bare anchor link (local, as on diff)
12702 !! options
12703 comment
12704 local
12705 title=[[Main Page]]
12706 !!input
12707 [[#section]]
12708 !! result
12709 <a href="#section">#section</a>
12710 !! end
12711
12712 !! test
12713 Edit comment with bare anchor link (non-local, as on history)
12714 !! options
12715 comment
12716 title=[[Main Page]]
12717 !!input
12718 [[#section]]
12719 !! result
12720 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12721 !! end
12722
12723 !! test
12724 Anchor starting with underscore
12725 !!input
12726 [[#_ref|One]]
12727 !! result
12728 <p><a href="#_ref">One</a>
12729 </p>
12730 !! end
12731
12732 !! test
12733 Id starting with underscore
12734 !!input
12735 <div id="_ref"></div>
12736 !! result
12737 <div id="_ref"></div>
12738
12739 !! end
12740
12741 !! test
12742 Space normalisation on autocomment (bug 22784)
12743 !! options
12744 comment
12745 title=[[Main Page]]
12746 !!input
12747 /* __hello__world__ */
12748 !! result
12749 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12750 !! end
12751
12752 !! test
12753 percent-encoding and + signs in comments (Bug 26410)
12754 !! options
12755 comment
12756 !!input
12757 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12758 !! result
12759 <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
12760 !! end
12761
12762 !! test
12763 Bad images - basic functionality
12764 !! options
12765 disabled
12766 !! input
12767 [[File:Bad.jpg]]
12768 !! result
12769 !! end
12770
12771 !! test
12772 Bad images - bug 16039: text after bad image disappears
12773 !! options
12774 disabled
12775 !! input
12776 Foo bar
12777 [[File:Bad.jpg]]
12778 Bar foo
12779 !! result
12780 <p>Foo bar
12781 </p><p>Bar foo
12782 </p>
12783 !! end
12784
12785 !! test
12786 Verify that displaytitle works (bug #22501) no displaytitle
12787 !! options
12788 showtitle
12789 !! config
12790 wgAllowDisplayTitle=true
12791 wgRestrictDisplayTitle=false
12792 !! input
12793 this is not the the title
12794 !! result
12795 Parser test
12796 <p>this is not the the title
12797 </p>
12798 !! end
12799
12800 !! test
12801 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12802 !! options
12803 showtitle
12804 title=[[Screen]]
12805 !! config
12806 wgAllowDisplayTitle=true
12807 wgRestrictDisplayTitle=false
12808 !! input
12809 this is not the the title
12810 {{DISPLAYTITLE:whatever}}
12811 !! result
12812 whatever
12813 <p>this is not the the title
12814 </p>
12815 !! end
12816
12817 !! test
12818 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12819 !! options
12820 showtitle
12821 title=[[Screen]]
12822 !! config
12823 wgAllowDisplayTitle=true
12824 wgRestrictDisplayTitle=true
12825 !! input
12826 this is not the the title
12827 {{DISPLAYTITLE:whatever}}
12828 !! result
12829 Screen
12830 <p>this is not the the title
12831 </p>
12832 !! end
12833
12834 !! test
12835 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12836 !! options
12837 showtitle
12838 title=[[Screen]]
12839 !! config
12840 wgAllowDisplayTitle=true
12841 wgRestrictDisplayTitle=true
12842 !! input
12843 this is not the the title
12844 {{DISPLAYTITLE:screen}}
12845 !! result
12846 screen
12847 <p>this is not the the title
12848 </p>
12849 !! end
12850
12851 !! test
12852 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12853 !! options
12854 showtitle
12855 title=[[Screen]]
12856 !! config
12857 wgAllowDisplayTitle=false
12858 !! input
12859 this is not the the title
12860 {{DISPLAYTITLE:screen}}
12861 !! result
12862 Screen
12863 <p>this is not the the title
12864 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
12865 </p>
12866 !! end
12867
12868 !! test
12869 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12870 !! options
12871 showtitle
12872 title=[[Screen]]
12873 !! config
12874 wgAllowDisplayTitle=false
12875 !! input
12876 this is not the the title
12877 !! result
12878 Screen
12879 <p>this is not the the title
12880 </p>
12881 !! end
12882
12883 !! test
12884 preload: check <noinclude> and <includeonly>
12885 !! options
12886 preload
12887 !! input
12888 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12889 !! result
12890 Hello kind world.
12891 !! end
12892
12893 !! test
12894 preload: check <onlyinclude>
12895 !! options
12896 preload
12897 !! input
12898 Goodbye <onlyinclude>Hello world</onlyinclude>
12899 !! result
12900 Hello world
12901 !! end
12902
12903 !! test
12904 preload: can pass tags through if we want to
12905 !! options
12906 preload
12907 !! input
12908 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12909 !! result
12910 <includeonly>Hello world</includeonly>
12911 !! end
12912
12913 !! test
12914 preload: check that it doesn't try to do tricks
12915 !! options
12916 preload
12917 !! input
12918 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12919 !! result
12920 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12921 !! end
12922
12923 !! test
12924 Play a bit with r67090 and bug 3158
12925 !! options
12926 disabled
12927 !! input
12928 <div style="width:50% !important">&nbsp;</div>
12929 <div style="width:50%&nbsp;!important">&nbsp;</div>
12930 <div style="width:50%&#160;!important">&nbsp;</div>
12931 <div style="border : solid;">&nbsp;</div>
12932 !! result
12933 <div style="width:50% !important">&nbsp;</div>
12934 <div style="width:50% !important">&nbsp;</div>
12935 <div style="width:50% !important">&nbsp;</div>
12936 <div style="border&#160;: solid;">&nbsp;</div>
12937
12938 !! end
12939
12940 !! test
12941 HTML5 data attributes
12942 !! input
12943 <span data-foo="bar">Baz</span>
12944 <p data-abc-def_hij="">Quuz</p>
12945 !! result
12946 <p><span data-foo="bar">Baz</span>
12947 </p>
12948 <p data-abc-def_hij="">Quuz</p>
12949
12950 !! end
12951
12952 !! test
12953 percent-encoding and + signs in internal links (Bug 26410)
12954 !! input
12955 [[User:+%]] [[Page+title%]]
12956 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12957 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12958 [[%33%45]] [[%33%45+]]
12959 !! result
12960 <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
12961 <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
12962 <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
12963 <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
12964 </p>
12965 !! end
12966
12967 !! test
12968 Special characters in embedded file links (bug 27679)
12969 !! input
12970 [[File:Contains & ampersand.jpg]]
12971 [[File:Does not exist.jpg|Title with & ampersand]]
12972 !! result
12973 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
12974 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
12975 </p>
12976 !! end
12977
12978
12979 !! test
12980 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12981 !! input
12982 Text&apos;s been normalized?
12983 !! result
12984 <p>Text&#39;s been normalized?
12985 </p>
12986 !! end
12987
12988 !! test
12989 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12990 !! input
12991 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12992 !! result
12993 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12994 </p>
12995 !! end
12996
12997 !! test
12998 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12999 !! input
13000 [http://www.example.org/ ideograms]
13001 !! result
13002 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13003 </p>
13004 !! end
13005
13006 !! test
13007 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13008 !! input
13009 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13010 !! result
13011 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13012 </p>
13013 !! end
13014
13015 !! article
13016 Mediawiki:loop1
13017 !! text
13018 {{Identical|A}}
13019 !! endarticle
13020
13021 !! article
13022 Mediawiki:loop2
13023 !! text
13024 {{Identical|B}}
13025 !! endarticle
13026
13027 !! article
13028 Template:Identical
13029 !! text
13030 {{int:loop1}}
13031 {{int:loop2}}
13032 !! endarticle
13033
13034 !! test
13035 Bug 31098 Template which includes system messages which includes the template
13036 !! input
13037 {{Identical}}
13038 !! result
13039 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13040 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13041 </p>
13042 !! end
13043
13044 !! test
13045 Bug31490 Turkish: ucfirst 'blah'
13046 !! options
13047 language=tr
13048 !! input
13049 {{ucfirst:blah}}
13050 !! result
13051 <p>Blah
13052 </p>
13053 !! end
13054
13055 !! test
13056 Bug31490 Turkish: ucfirst 'ix'
13057 !! options
13058 language=tr
13059 !! input
13060 {{ucfirst:ix}}
13061 !! result
13062 <p>İx
13063 </p>
13064 !! end
13065
13066 !! test
13067 Bug31490 Turkish: lcfirst 'BLAH'
13068 !! options
13069 language=tr
13070 !! input
13071 {{lcfirst:BLAH}}
13072 !! result
13073 <p>bLAH
13074 </p>
13075 !! end
13076
13077 !! test
13078 Bug31490 Turkish: ucfırst (with a dotless i)
13079 !! options
13080 language=tr
13081 !! input
13082 {{ucfırst:blah}}
13083 !! result
13084 <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
13085 </p>
13086 !! end
13087
13088 !! test
13089 Bug31490 ucfırst (with a dotless i) with English language
13090 !! options
13091 language=en
13092 !! input
13093 {{ucfırst:blah}}
13094 !! result
13095 <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
13096 </p>
13097 !! end
13098
13099 !! test
13100 Bug 26375: TOC with italics
13101 !! options
13102 title=[[Main Page]]
13103 !! input
13104 __TOC__
13105 == ''Lost'' episodes ==
13106 !! result
13107 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13108 <ul>
13109 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
13110 </ul>
13111 </td></tr></table>
13112 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span> <span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span></h2>
13113
13114 !! end
13115
13116 !! test
13117 Bug 26375: TOC with bold
13118 !! options
13119 title=[[Main Page]]
13120 !! input
13121 __TOC__
13122 == '''should be bold''' then normal text ==
13123 !! result
13124 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13125 <ul>
13126 <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
13127 </ul>
13128 </td></tr></table>
13129 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a>]</span> <span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span></h2>
13130
13131 !! end
13132
13133 !! test
13134 Bug 33845: Headings become cursive in TOC when they contain an image
13135 !! options
13136 title=[[Main Page]]
13137 !! input
13138 __TOC__
13139 == Image [[Image:foobar.jpg]] ==
13140 !! result
13141 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13142 <ul>
13143 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13144 </ul>
13145 </td></tr></table>
13146 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span> <span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span></h2>
13147
13148 !! end
13149
13150 !! test
13151 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13152 !! options
13153 title=[[Main Page]]
13154 !! input
13155 __TOC__
13156 == <blockquote>Quote</blockquote> ==
13157 !! result
13158 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13159 <ul>
13160 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13161 </ul>
13162 </td></tr></table>
13163 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span> <span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span></h2>
13164
13165 !! end
13166
13167 !! test
13168 Unclosed tags in TOC
13169 !! options
13170 title=[[Main Page]]
13171 !! input
13172 __TOC__
13173 == Proof: 2 < 3 ==
13174 <small>Hanc marginis exiguitas non caperet.</small>
13175 QED
13176 !! result
13177 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13178 <ul>
13179 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
13180 </ul>
13181 </td></tr></table>
13182 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span> <span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span></h2>
13183 <p><small>Hanc marginis exiguitas non caperet.</small>
13184 QED
13185 </p>
13186 !! end
13187
13188 !! test
13189 Multiple tags in TOC
13190 !! input
13191 __TOC__
13192 == <i>Foo</i> <b>Bar</b> ==
13193
13194 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13195 !! result
13196 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13197 <ul>
13198 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
13199 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
13200 </ul>
13201 </td></tr></table>
13202 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span></h2>
13203 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span></h2>
13204
13205 !! end
13206
13207 !! test
13208 Tags with parameters in TOC
13209 !! input
13210 __TOC__
13211 == <sup class="in-h2">Hello</sup> ==
13212
13213 == <sup class="a > b">Evilbye</sup> ==
13214 !! result
13215 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13216 <ul>
13217 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13218 <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
13219 </ul>
13220 </td></tr></table>
13221 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span> <span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span></h2>
13222 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span> <span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span></h2>
13223
13224 !! end
13225
13226 !! test
13227 span tags with directionality in TOC
13228 !! input
13229 __TOC__
13230 == <span dir="ltr">C++</span> ==
13231
13232 == <span dir="rtl">זבנג!</span> ==
13233
13234 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13235
13236 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13237
13238 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13239 !! result
13240 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13241 <ul>
13242 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
13243 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
13244 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
13245 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
13246 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
13247 </ul>
13248 </td></tr></table>
13249 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span> <span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span></h2>
13250 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span> <span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span></h2>
13251 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a>]</span> <span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span></h2>
13252 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a>]</span> <span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span></h2>
13253 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a>]</span> <span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span></h2>
13254
13255 !! end
13256
13257 !! article
13258 MediaWiki:Bug32057
13259 !! text
13260 == {{int:headline_sample}} ==
13261 !! endarticle
13262
13263 !! test
13264 Bug 32057: Title needed when expanding <h> nodes.
13265 !! options
13266 title=[[Main Page]]
13267 !! input
13268 {{int:Bug32057}}
13269 !! result
13270 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span> <span class="mw-headline" id="Headline_text">Headline text</span></h2>
13271
13272 !! end
13273
13274 !! test
13275 Strip marker in urlencode
13276 !! input
13277 {{urlencode:x<nowiki/>y}}
13278 {{urlencode:x<nowiki/>y|wiki}}
13279 {{urlencode:x<nowiki/>y|path}}
13280 !! result
13281 <p>xy
13282 xy
13283 xy
13284 </p>
13285 !! end
13286
13287 !! test
13288 Strip marker in lc
13289 !! input
13290 {{lc:x<nowiki/>y}}
13291 !! result
13292 <p>xy
13293 </p>
13294 !! end
13295
13296 !! test
13297 Strip marker in uc
13298 !! input
13299 {{uc:x<nowiki/>y}}
13300 !! result
13301 <p>XY
13302 </p>
13303 !! end
13304
13305 !! test
13306 Strip marker in formatNum
13307 !! input
13308 {{formatnum:1<nowiki/>2}}
13309 {{formatnum:1<nowiki/>2|R}}
13310 !! result
13311 <p>12
13312 12
13313 </p>
13314 !! end
13315
13316 !! test
13317 Check noCommafy in formatNum
13318 !! options
13319 language=be-tarask
13320 !! input
13321 {{formatnum:123456.78}}
13322 {{formatnum:123456.78|NOSEP}}
13323 !! result
13324 <p>123 456,78
13325 123456.78
13326 </p>
13327 !! end
13328
13329 !! test
13330 Strip marker in grammar
13331 !! options
13332 language=fi
13333 !! input
13334 {{grammar:elative|foo<nowiki/>bar}}
13335 !! result
13336 <p>foobarista
13337 </p>
13338 !! end
13339
13340 !! test
13341 Strip marker in padleft
13342 !! input
13343 {{padleft:|2|x<nowiki/>y}}
13344 !! result
13345 <p>xy
13346 </p>
13347 !! end
13348
13349 !! test
13350 Strip marker in padright
13351 !! input
13352 {{padright:|2|x<nowiki/>y}}
13353 !! result
13354 <p>xy
13355 </p>
13356 !! end
13357
13358 !! test
13359 Strip marker in anchorencode
13360 !! input
13361 {{anchorencode:x<nowiki/>y}}
13362 !! result
13363 <p>xy
13364 </p>
13365 !! end
13366
13367 !! test
13368 nowiki inside link inside heading (bug 18295)
13369 !! input
13370 ==[[foo|x<nowiki>y</nowiki>z]]==
13371 !! result
13372 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span> <span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">xyz</a></span></h2>
13373
13374 !! end
13375
13376 !! test
13377 new support for bdi element (bug 31817)
13378 !! input
13379 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13380 !! result
13381 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13382
13383 !!end
13384
13385 !! test
13386 Ignore pipe between table row attributes
13387 !! input
13388 {|
13389 | quux
13390 |- id=foo | style='color: red'
13391 | bar
13392 |}
13393 !! result
13394 <table>
13395 <tr>
13396 <td> quux
13397 </td></tr>
13398 <tr id="foo" style="color: red">
13399 <td> bar
13400 </td></tr></table>
13401
13402 !! end
13403
13404 !!test
13405 Gallery override link with WikiLink (bug 34852)
13406 !! input
13407 <gallery>
13408 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13409 </gallery>
13410 !! result
13411 <ul class="gallery">
13412 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13413 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13414 <div class="gallerytext">
13415 <p>caption
13416 </p>
13417 </div>
13418 </div></li>
13419 </ul>
13420
13421 !! end
13422
13423 !!test
13424 Gallery override link with absolute external link (bug 34852)
13425 !! input
13426 <gallery>
13427 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13428 </gallery>
13429 !! result
13430 <ul class="gallery">
13431 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13432 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13433 <div class="gallerytext">
13434 <p>caption
13435 </p>
13436 </div>
13437 </div></li>
13438 </ul>
13439
13440 !! end
13441
13442 !!test
13443 Gallery override link with malicious javascript (bug 34852)
13444 !! input
13445 <gallery>
13446 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13447 </gallery>
13448 !! result
13449 <ul class="gallery">
13450 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13451 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13452 <div class="gallerytext">
13453 <p>caption
13454 </p>
13455 </div>
13456 </div></li>
13457 </ul>
13458
13459 !! end
13460
13461 !!test
13462 Gallery with invalid title as link (bug 43964)
13463 !! input
13464 <gallery>
13465 File:foobar.jpg|link=<
13466 </gallery>
13467 !! result
13468 <ul class="gallery">
13469 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13470 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13471 <div class="gallerytext">
13472 </div>
13473 </div></li>
13474 </ul>
13475
13476 !! end
13477
13478 !!test
13479 Language parser function
13480 !! input
13481 {{#language:ar}}
13482 !! result
13483 <p>العربية
13484 </p>
13485 !! end
13486
13487 !!test
13488 Padleft and padright as substr
13489 !! input
13490 {{padleft:|3|abcde}}
13491 {{padright:|3|abcde}}
13492 !! result
13493 <p>abc
13494 abc
13495 </p>
13496 !! end
13497
13498 !!test
13499 Bug 34939 - Case insensitive link parsing ([HttP://])
13500 !! input
13501 [HttP://MediaWiki.Org/]
13502 !! result
13503 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13504 </p>
13505 !! end
13506
13507 !!test
13508 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13509 !! input
13510 [HttP://MediaWiki.Org/ MediaWiki]
13511 !! result
13512 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13513 </p>
13514 !! end
13515
13516 !!test
13517 Bug 34939 - Case insensitive link parsing (HttP://)
13518 !! input
13519 HttP://MediaWiki.Org/
13520 !! result
13521 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13522 </p>
13523 !! end
13524
13525 ###
13526 ### Parsoids-specific tests
13527 ### Parsoid-PHP parser incompatibilities
13528 ###
13529 !!test
13530 1. SOL-sensitive wikitext tokens as template-args
13531 !!options
13532 disabled
13533 !!input
13534 {{echo|*a}}
13535 {{echo|#a}}
13536 {{echo|:a}}
13537 !!result
13538 <p>*a
13539 #a
13540 :a
13541 </p>
13542 !!end
13543
13544 #### The following section of tests are primarily to test
13545 #### wikitext escaping capabilities of Parsoid.
13546 #### A lot of the tests are disabled for the PHP parser either
13547 #### because of minor newline diffs or other reasons.
13548 #### As Parsoid serializer can handle newlines and other HTML
13549 #### more robustly, some of these tests might get reenabled
13550 #### for the PHP parser.
13551
13552 #### --------------- Headings ---------------
13553 #### 0. Unnested
13554 #### 1. Nested inside html <h1>=foo=</h1>
13555 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13556 #### 3. Nested inside html with wikitext split by html tags
13557 #### 4. No escape needed
13558 #### 5. Empty headings <h1></h1>
13559 #### 6. Heading chars in SOL context
13560 #### ----------------------------------------
13561 !! test
13562 Headings: 0. Unnested
13563 !! input
13564 <nowiki>=foo=</nowiki>
13565
13566 <nowiki>=foo</nowiki>''a''=
13567 !! result
13568 <p>=foo=
13569 </p><p>=foo<i>a</i>=
13570 </p>
13571 !!end
13572
13573 !! test
13574 Headings: 1. Nested inside html
13575 !! options
13576 disabled
13577 !! input
13578 =<nowiki>=foo=</nowiki>=
13579 ==<nowiki>=foo=</nowiki>==
13580 ===<nowiki>=foo=</nowiki>===
13581 ====<nowiki>=foo=</nowiki>====
13582 =====<nowiki>=foo=</nowiki>=====
13583 ======<nowiki>=foo=</nowiki>======
13584 !! result
13585 <h1>=foo=</h1>
13586 <h2>=foo=</h2>
13587 <h3>=foo=</h3>
13588 <h4>=foo=</h4>
13589 <h5>=foo=</h5>
13590 <h6>=foo=</h6>
13591 !!end
13592
13593 !! test
13594 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13595 !! options
13596 disabled
13597 !! input
13598 =foo=
13599 <nowiki>*bar</nowiki>
13600 =foo=
13601 =bar
13602 =foo=
13603 <nowiki>=bar=</nowiki>
13604 !! result
13605 <h1>foo</h1>*bar
13606 <h1>foo</h1>=bar
13607 <h1>foo</h1>=bar=
13608 !!end
13609
13610 !! test
13611 Headings: 3. Nested inside html with wikitext split by html tags
13612 !! options
13613 disabled
13614 !! input
13615 =<nowiki>=</nowiki>'''bold'''foo==
13616 !! result
13617 <h1>=<b>bold</b>foo=</h1>
13618 !!end
13619
13620 !! test
13621 Headings: 4. No escaping needed (testing just h1 and h2)
13622 !! options
13623 disabled
13624 !! input
13625 ==foo=
13626 =foo==
13627 ===foo==
13628 ==foo===
13629 =''=''foo==
13630 ===
13631 !! result
13632 <h1>=foo</h1>
13633 <h1>foo=</h1>
13634 <h2>=foo</h2>
13635 <h2>foo=</h2>
13636 <h1><i>=</i>foo=</h1>
13637 <h1>=</h1>
13638 !!end
13639
13640 !! test
13641 Headings: 5. Empty headings
13642 !! options
13643 disabled
13644 !! input
13645 =<nowiki></nowiki>=
13646 ==<nowiki></nowiki>==
13647 ===<nowiki></nowiki>===
13648 ====<nowiki></nowiki>====
13649 =====<nowiki></nowiki>=====
13650 ======<nowiki></nowiki>======
13651 !! result
13652 <h1></h1>
13653 <h2></h2>
13654 <h3></h3>
13655 <h4></h4>
13656 <h5></h5>
13657 <h6></h6>
13658 !!end
13659
13660 !! test
13661 Headings: 6. Heading chars in SOL context
13662 !! options
13663 disabled
13664 !! input
13665 <!--cmt--><nowiki>=h1=</nowiki>
13666 !! result
13667 <p><!--cmt-->=h1=
13668 </p>
13669 !!end
13670
13671 #### --------------- Lists ---------------
13672 #### 0. Outside nests (*foo, etc.)
13673 #### 1. Nested inside html <ul><li>*foo</li></ul>
13674 #### 2. Inside definition lists
13675 #### 3. Only bullets at start should be escaped
13676 #### 4. No escapes needed
13677 #### 5. No unnecessary escapes
13678 #### 6. Escape bullets in SOL position
13679 #### 7. Escape bullets in a multi-line context
13680 #### ----------------------------------------
13681
13682 !! test
13683 Lists: 0. Outside nests
13684 !! input
13685 <nowiki>*foo</nowiki>
13686
13687 <nowiki>#foo</nowiki>
13688 !! result
13689 <p>*foo
13690 </p><p>#foo
13691 </p>
13692 !!end
13693
13694 !! test
13695 Lists: 1. Nested inside html
13696 !! input
13697 *<nowiki>*foo</nowiki>
13698
13699 *<nowiki>#foo</nowiki>
13700
13701 *<nowiki>:foo</nowiki>
13702
13703 *<nowiki>;foo</nowiki>
13704
13705 #<nowiki>*foo</nowiki>
13706
13707 #<nowiki>#foo</nowiki>
13708
13709 #<nowiki>:foo</nowiki>
13710
13711 #<nowiki>;foo</nowiki>
13712 !! result
13713 <ul><li>*foo
13714 </li></ul>
13715 <ul><li>#foo
13716 </li></ul>
13717 <ul><li>:foo
13718 </li></ul>
13719 <ul><li>;foo
13720 </li></ul>
13721 <ol><li>*foo
13722 </li></ol>
13723 <ol><li>#foo
13724 </li></ol>
13725 <ol><li>:foo
13726 </li></ol>
13727 <ol><li>;foo
13728 </li></ol>
13729
13730 !!end
13731
13732 !! test
13733 Lists: 2. Inside definition lists
13734 !! input
13735 ;<nowiki>;foo</nowiki>
13736
13737 ;<nowiki>:foo</nowiki>
13738
13739 ;<nowiki>:foo</nowiki>
13740 :bar
13741
13742 :<nowiki>:foo</nowiki>
13743 !! result
13744 <dl><dt>;foo
13745 </dt></dl>
13746 <dl><dt>:foo
13747 </dt></dl>
13748 <dl><dt>:foo
13749 </dt><dd>bar
13750 </dd></dl>
13751 <dl><dd>:foo
13752 </dd></dl>
13753
13754 !!end
13755
13756 !! test
13757 Lists: 3. Only bullets at start of text should be escaped
13758 !! input
13759 *<nowiki>*foo*bar</nowiki>
13760
13761 *<nowiki>*foo</nowiki>''it''*bar
13762 !! result
13763 <ul><li>*foo*bar
13764 </li></ul>
13765 <ul><li>*foo<i>it</i>*bar
13766 </li></ul>
13767
13768 !!end
13769
13770 !! test
13771 Lists: 4. No escapes needed
13772 !! options
13773 disabled
13774 !! input
13775 *foo*bar
13776
13777 *''foo''*bar
13778
13779 *[[Foo]]: bar
13780 !! result
13781 <ul><li>foo*bar
13782 </li></ul>
13783 <ul><li><i>foo</i>*bar
13784 </li></ul>
13785 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13786 </li></ul>
13787 !!end
13788
13789 !! test
13790 Lists: 5. No unnecessary escapes
13791 !! input
13792 * bar <span><nowiki>[[foo]]</nowiki></span>
13793
13794 *=bar <span><nowiki>[[foo]]</nowiki></span>
13795
13796 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13797
13798 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13799
13800 *=bar <span>foo]]</span>=
13801 !! result
13802 <ul><li> bar <span>[[foo]]</span>
13803 </li></ul>
13804 <ul><li>=bar <span>[[foo]]</span>
13805 </li></ul>
13806 <ul><li>[[bar <span>[[foo]]</span>
13807 </li></ul>
13808 <ul><li>]]bar <span>[[foo]]</span>
13809 </li></ul>
13810 <ul><li>=bar <span>foo]]</span>=
13811 </li></ul>
13812
13813 !!end
13814
13815 !! test
13816 Lists: 6. Escape bullets in SOL position
13817 !! options
13818 disabled
13819 !! input
13820 <!--cmt--><nowiki>*foo</nowiki>
13821 !! result
13822 <p><!--cmt-->*foo
13823 </p>
13824 !!end
13825
13826 !! test
13827 Lists: 7. Escape bullets in a multi-line context
13828 !! input
13829 <nowiki>a
13830 *b</nowiki>
13831 !! result
13832 <p>a
13833 *b
13834 </p>
13835 !!end
13836
13837 #### --------------- HRs ---------------
13838 #### 1. Single line
13839 #### -----------------------------------
13840
13841 !! test
13842 HRs: 1. Single line
13843 !! options
13844 disabled
13845 !! input
13846 ----
13847 <nowiki>----</nowiki>
13848 ----
13849 <nowiki>=foo=</nowiki>
13850 ----
13851 <nowiki>*foo</nowiki>
13852 !! result
13853 <hr/>----
13854 <hr/>=foo=
13855 <hr/>*foo
13856 !! end
13857
13858 #### --------------- Tables ---------------
13859 #### 1a. Simple example
13860 #### 1b. No escaping needed (!foo)
13861 #### 1c. No escaping needed (|foo)
13862 #### 1d. No escaping needed (|}foo)
13863 ####
13864 #### 2a. Nested in td (<td>foo|bar</td>)
13865 #### 2b. Nested in td (<td>foo||bar</td>)
13866 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13867 ####
13868 #### 3a. Nested in th (<th>foo!bar</th>)
13869 #### 3b. Nested in th (<th>foo!!bar</th>)
13870 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13871 ####
13872 #### 4a. Escape -
13873 #### 4b. Escape +
13874 #### 4c. No escaping needed
13875 #### --------------------------------------
13876
13877 !! test
13878 Tables: 1a. Simple example
13879 !! input
13880 <nowiki>{|
13881 |}</nowiki>
13882 !! result
13883 <p>{|
13884 |}
13885 </p>
13886 !! end
13887
13888 !! test
13889 Tables: 1b. No escaping needed
13890 !! input
13891 !foo
13892 !! result
13893 <p>!foo
13894 </p>
13895 !! end
13896
13897 !! test
13898 Tables: 1c. No escaping needed
13899 !! input
13900 |foo
13901 !! result
13902 <p>|foo
13903 </p>
13904 !! end
13905
13906 !! test
13907 Tables: 1d. No escaping needed
13908 !! input
13909 |}foo
13910 !! result
13911 <p>|}foo
13912 </p>
13913 !! end
13914
13915 !! test
13916 Tables: 2a. Nested in td
13917 !! options
13918 disabled
13919 !! input
13920 {|
13921 |<nowiki>foo|bar</nowiki>
13922 |}
13923 !! result
13924 <table>
13925 <tr><td>foo|bar
13926 </td></tr></table>
13927
13928 !! end
13929
13930 !! test
13931 Tables: 2b. Nested in td
13932 !! options
13933 disabled
13934 !! input
13935 {|
13936 |<nowiki>foo||bar</nowiki>
13937 |''it''<nowiki>foo||bar</nowiki>
13938 |}
13939 !! result
13940 <table>
13941 <tr><td>foo||bar
13942 </td><td><i>it</i>foo||bar
13943 </td></tr></table>
13944
13945 !! end
13946
13947 !! test
13948 Tables: 2c. Nested in td -- no escaping needed
13949 !! options
13950 disabled
13951 !! input
13952 {|
13953 |foo!!bar
13954 |}
13955 !! result
13956 <table>
13957 <tr><td>foo!!bar
13958 </td></tr></table>
13959
13960 !! end
13961
13962 !! test
13963 Tables: 3a. Nested in th
13964 !! options
13965 disabled
13966 !! input
13967 {|
13968 !foo!bar
13969 |}
13970 !! result
13971 <table>
13972 <tr><th>foo!bar
13973 </th></tr></table>
13974
13975 !! end
13976
13977 !! test
13978 Tables: 3b. Nested in th
13979 !! options
13980 disabled
13981 !! input
13982 {|
13983 !<nowiki>foo!!bar</nowiki>
13984 |}
13985 !! result
13986 <table>
13987 <tr><th>foo!!bar
13988 </th></tr></table>
13989
13990 !! end
13991
13992 !! test
13993 Tables: 3c. Nested in th -- no escaping needed
13994 !! options
13995 disabled
13996 !! input
13997 {|
13998 !foo||bar
13999 |}
14000 !! result
14001 <table>
14002 <tr><th>foo||bar
14003 </th></tr></table>
14004
14005 !! end
14006
14007 !! test
14008 Tables: 4a. Escape -
14009 !! options
14010 disabled
14011 !! input
14012 {|
14013 |-
14014 !-bar
14015 |-
14016 |<nowiki>-bar</nowiki>
14017 |}
14018 !! result
14019 <table><tbody>
14020 <tr><th>-bar</th></tr>
14021 <tr><td>-bar</td></tr>
14022 </tbody></table>
14023 !! end
14024
14025 !! test
14026 Tables: 4b. Escape +
14027 !! options
14028 disabled
14029 !! input
14030 {|
14031 |-
14032 !+bar
14033 |-
14034 |<nowiki>+bar</nowiki>
14035 |}
14036 !! result
14037 <table><tbody>
14038 <tr><th>+bar</th></tr>
14039 <tr><td>+bar</td></tr>
14040 </tbody></table>
14041 !! end
14042
14043 !! test
14044 Tables: 4c. No escaping needed
14045 !! options
14046 disabled
14047 !! input
14048 {|
14049 |-
14050 |foo-bar
14051 |foo+bar
14052 |-
14053 |''foo''-bar
14054 |''foo''+bar
14055 |}
14056 !! result
14057 <table><tbody>
14058 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14059 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14060 </tbody></table>
14061 !! end
14062
14063 !! test
14064 Tables: 4d. No escaping needed
14065 !! input
14066 {|
14067 ||+1
14068 ||-2
14069 |}
14070 !! result
14071 <table>
14072 <tr>
14073 <td>+1
14074 </td>
14075 <td>-2
14076 </td></tr></table>
14077
14078 !! end
14079
14080 #### --------------- Links ---------------
14081 #### 1. Quote marks in link text
14082 #### 2. Wikilinks: Escapes needed
14083 #### 3. Wikilinks: No escapes needed
14084 #### 4. Extlinks: Escapes needed
14085 #### 5. Extlinks: No escapes needed
14086 #### --------------------------------------
14087 !! test
14088 Links 1. Quote marks in link text
14089 !! options
14090 disabled
14091 !! input
14092 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14093 !! result
14094 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14095 !! end
14096
14097 !! test
14098 Links 2. WikiLinks: Escapes needed
14099 !! options
14100 disabled
14101 !! input
14102 [[Foo|<nowiki>[Foobar]</nowiki>]]
14103 [[Foo|<nowiki>Foobar]</nowiki>]]
14104 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
14105 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14106 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14107 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14108 [[Foo|<nowiki>|Bar</nowiki>]]
14109 !! result
14110 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14111 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14112 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14113 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14114 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14115 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14116 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14117 !! end
14118
14119 !! test
14120 Links 3. WikiLinks: No escapes needed
14121 !! options
14122 disabled
14123 !! input
14124 [[Foo|[Foobar]]
14125 [[Foo|foo|bar]]
14126 !! result
14127 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14128 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14129 !! end
14130
14131 !! test
14132 Links 4. ExtLinks: Escapes needed
14133 !! options
14134 disabled
14135 !! input
14136 [http://google.com <nowiki>[google]</nowiki>]
14137 [http://google.com <nowiki>google]</nowiki>]
14138 !! result
14139 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14140 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14141 !! end
14142
14143 !! test
14144 Links 5. ExtLinks: No escapes needed
14145 !! options
14146 disabled
14147 !! input
14148 [http://google.com [google]
14149 !! result
14150 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14151 !! end
14152
14153 #### --------------- Quotes ---------------
14154 #### 1. Quotes inside <b> and <i>
14155 #### 2. Link fragments separated by <i> and <b> tags
14156 #### 3. Link fragments inside <i> and <b>
14157 #### --------------------------------------
14158 !! test
14159 1. Quotes inside <b> and <i>
14160 !! input
14161 ''<nowiki>'foo'</nowiki>''
14162 ''<nowiki>''foo''</nowiki>''
14163 ''<nowiki>'''foo'''</nowiki>''
14164 '''<nowiki>'foo'</nowiki>'''
14165 '''<nowiki>''foo''</nowiki>'''
14166 '''<nowiki>'''foo'''</nowiki>'''
14167 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14168 !! result
14169 <p><i>'foo'</i>
14170 <i>''foo''</i>
14171 <i>'''foo'''</i>
14172 <b>'foo'</b>
14173 <b>''foo''</b>
14174 <b>'''foo'''</b>
14175 <b>foo'<i>bar'</i>baz</b>
14176 </p>
14177 !! end
14178
14179 !! test
14180 2. Link fragments separated by <i> and <b> tags
14181 !! input
14182 [[''foo''<nowiki>hello]]</nowiki>
14183
14184 [['''foo'''<nowiki>hello]]</nowiki>
14185 !! result
14186 <p>[[<i>foo</i>hello]]
14187 </p><p>[[<b>foo</b>hello]]
14188 </p>
14189 !! end
14190
14191 !! test
14192 2. Link fragments inside <i> and <b>
14193 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14194 this is one of the shortcomings of this format)
14195 !! input
14196 ''[[foo''<nowiki>]]</nowiki>
14197
14198 '''[[foo'''<nowiki>]]</nowiki>
14199 !! result
14200 <p><i>[[foo</i>]]
14201 </p><p><b>[[foo</b>]]
14202 </p>
14203 !! end
14204
14205 #### --------------- Paragraphs ---------------
14206 #### 1. No unnecessary escapes
14207 #### --------------------------------------
14208
14209 !! test
14210 1. No unnecessary escapes
14211 !! input
14212 bar <span><nowiki>[[foo]]</nowiki></span>
14213
14214 =bar <span><nowiki>[[foo]]</nowiki></span>
14215
14216 [[bar <span><nowiki>[[foo]]</nowiki></span>
14217
14218 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
14219
14220 <nowiki>=bar </nowiki><span>foo]]</span>=
14221 !! result
14222 <p>bar <span>[[foo]]</span>
14223 </p><p>=bar <span>[[foo]]</span>
14224 </p><p>[[bar <span>[[foo]]</span>
14225 </p><p>]]bar <span>[[foo]]</span>
14226 </p><p>=bar <span>foo]]</span>=
14227 </p>
14228 !!end
14229
14230 #### --------------- PRE ------------------
14231 #### 1. Leading space in SOL context should be escaped
14232 #### --------------------------------------
14233 !! test
14234 1. Leading space in SOL context should be escaped
14235 !! options
14236 disabled
14237 !! input
14238 <nowiki> foo</nowiki>
14239 <!--cmt--><nowiki> foo</nowiki>
14240 !! result
14241 <p> foo
14242 <!--cmt--> foo
14243 </p>
14244 !! end
14245
14246 #### --------------- HTML tags ---------------
14247 #### 1. a tags
14248 #### 2. other tags
14249 #### 3. multi-line html tag
14250 #### --------------------------------------
14251 !! test
14252 1. a tags
14253 !! options
14254 disabled
14255 !! input
14256 <a href="http://google.com">google</a>
14257 !! result
14258 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14259 !! end
14260
14261 !! test
14262 2. other tags
14263 !! input
14264 <nowiki><div>foo</div>
14265 <div style="color:red">foo</div></nowiki>
14266 !! result
14267 <p>&lt;div&gt;foo&lt;/div&gt;
14268 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14269 </p>
14270 !! end
14271
14272 !! test
14273 3. multi-line html tag
14274 !! input
14275 <nowiki><div
14276 >foo</div
14277 ></nowiki>
14278 !! result
14279 <p>&lt;div
14280 &gt;foo&lt;/div
14281 &gt;
14282 </p>
14283 !! end
14284
14285 #### --------------- Others ---------------
14286 !! test
14287 Escaping nowikis
14288 !! input
14289 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14290 !! result
14291 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14292 </p>
14293 !! end
14294
14295 !! test
14296 Tag-like HTML structures are passed through as text
14297 !! input
14298 <x y>
14299
14300 <x.y>
14301
14302 <x-y>
14303
14304 1>2
14305
14306 x<y
14307
14308 a>b
14309
14310 1<d e>f
14311 !! result
14312 <p>&lt;x y&gt;
14313 </p><p>&lt;x.y&gt;
14314 </p><p>&lt;x-y&gt;
14315 </p><p>1&gt;2
14316 </p><p>x&lt;y
14317 </p><p>a&gt;b
14318 </p><p>1&lt;d e&gt;f
14319 </p>
14320 !! end
14321
14322
14323 # This fails in the PHP parser (see bug 40670,
14324 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14325 !! test
14326 Tag names followed by punctuation should not be recognized as tags
14327 !! options
14328 disabled
14329 !! input
14330 <s.ome> text
14331 !! result
14332 <p>&lt;s.ome&gt text
14333 </p>
14334 !! end
14335
14336 !! test
14337 HTML tag with necessary entities in attributes
14338 !! input
14339 <span title="&amp;amp;">foo</span>
14340 !! result
14341 <p><span title="&amp;amp;">foo</span>
14342 </p>
14343 !! end
14344
14345 !! test
14346 HTML tag with 'unnecessary' entity encoding in attributes
14347 !! input
14348 <span title="&amp;">foo</span>
14349 !! result
14350 <p><span title="&amp;">foo</span>
14351 </p>
14352 !! end
14353
14354 !! test
14355 HTML tag with broken attribute value quoting
14356 !! input
14357 <span title="Hello world>Foo</span>
14358 !! result
14359 <p><span>Foo</span>
14360 </p>
14361 !! end
14362
14363 !! test
14364 Parsoid-only: HTML tag with broken attribute value quoting
14365 !! options
14366 parsoid
14367 !! input
14368 <span title="Hello world>Foo</span>
14369 !! result
14370 <p><span title="Hello world">Foo</span>
14371 </p>
14372 !! end
14373
14374 !! test
14375 Table with broken attribute value quoting
14376 !! input
14377 {|
14378 | title="Hello world|Foo
14379 |}
14380 !! result
14381 <table>
14382 <tr>
14383 <td>Foo
14384 </td></tr></table>
14385
14386 !! end
14387
14388 !! test
14389 Table with broken attribute value quoting on consecutive lines
14390 !! input
14391 {|
14392 | title="Hello world|Foo
14393 | style="color:red|Bar
14394 |}
14395 !! result
14396 <table>
14397 <tr>
14398 <td>Foo
14399 </td>
14400 <td>Bar
14401 </td></tr></table>
14402
14403 !! end
14404
14405 !! test
14406 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14407 !! options
14408 parsoid
14409 !! input
14410 {|
14411 | title="Hello world|Foo
14412 | style="color:red|Bar
14413 |}
14414 !! result
14415 <table>
14416 <tr>
14417 <td title="Hello world">Foo
14418 </td><td style="color: red">Bar
14419 </td></tr></table>
14420
14421 !! end
14422
14423 !! test
14424 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14425 !! options
14426 parsoid
14427 !! input
14428 {{}}
14429 !! result
14430 {{}}
14431 !! end
14432
14433 !! test
14434 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14435 !! options
14436 parsoid
14437 !! input
14438 }}{{
14439 !! result
14440 }}{{
14441 !! end
14442
14443 !!test
14444 Accept empty td cell attribute
14445 !!input
14446 {|
14447 | align="center" | foo || |
14448 |}
14449 !!result
14450 <table>
14451 <tr>
14452 <td align="center"> foo </td>
14453 <td>
14454 </td></tr></table>
14455
14456 !!end
14457
14458 !!test
14459 Non-empty attributes in th-cells
14460 !!input
14461 {|
14462 ! Foo !! style="color: red" | Bar
14463 |}
14464 !!result
14465 <table>
14466 <tr>
14467 <th> Foo </th>
14468 <th style="color: red"> Bar
14469 </th></tr></table>
14470
14471 !!end
14472
14473 !!test
14474 Accept empty attributes in th-cells
14475 !!input
14476 {|
14477 !| foo !!| bar
14478 |}
14479 !!result
14480 <table>
14481 <tr>
14482 <th> foo </th>
14483 <th> bar
14484 </th></tr></table>
14485
14486 !!end
14487
14488 !!test
14489 Empty table rows go away
14490 !!input
14491 {|
14492 | Hello
14493 | there
14494 |- class="foo"
14495 |-
14496 |}
14497 !! result
14498 <table>
14499 <tr>
14500 <td> Hello
14501 </td>
14502 <td> there
14503 </td></tr>
14504
14505 </table>
14506
14507 !! end
14508
14509 ###
14510 ### Parsoid-centric tests for testing RTing of inter-element separators
14511 ### Edge cases not tested by existing parser tests and specific to
14512 ### Parsoid-specific serialization strategies.
14513 ###
14514
14515 !!test
14516 RT-ed inter-element separators should be valid separators
14517 !!input
14518 {|
14519 |- [[foo]]
14520 |}
14521 !!result
14522 <table>
14523
14524 </table>
14525
14526 !!end
14527
14528 !!test
14529 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14530 (Parsoid-only since PHP parser relies on Tidy for correct output)
14531 !!options
14532 parsoid
14533 !!input
14534 {|
14535 |<small>foo
14536 bar
14537 |}
14538
14539 {|
14540 |<small>foo<small>
14541 |}
14542 !!result
14543 !!end
14544
14545 !!test
14546 Empty TD followed by TD with tpl-generated attribute
14547 !!input
14548 {|
14549 |-
14550 |
14551 |{{echo|style='color:red'}}|foo
14552 |}
14553 !!result
14554 <table>
14555
14556 <tr>
14557 <td>
14558 </td>
14559 <td>foo
14560 </td></tr></table>
14561
14562 !!end
14563
14564 !!test
14565 Indented table with an empty td
14566 !!input
14567 {|
14568 |-
14569 |
14570 |foo
14571 |}
14572 !!result
14573 <table>
14574
14575 <tr>
14576 <td>
14577 </td>
14578 <td>foo
14579 </td></tr></table>
14580
14581 !!end
14582
14583 !!test
14584 Empty TR followed by a template-generated TR
14585 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14586 !!options
14587 parsoid
14588 !!input
14589 {|
14590 |-
14591 {{echo|<tr><td>foo</td></tr>}}
14592 |}
14593 !!result
14594 <table>
14595 <tbody>
14596 <tr>
14597 </tr>
14598 <tr>
14599 <td>foo</td></tr></tbody></table>
14600 !!end
14601
14602 ## PHP and parsoid output differ for this, and since this is primarily
14603 ## for testing Parsoid's serializer, marking this Parsoid only
14604 !!test
14605 Empty TR followed by mixed-ws-comment line should RT correctly
14606 !!options
14607 parsoid
14608 !!input
14609 {|
14610 |-
14611 <!--c-->
14612 |-
14613 <!--c--> <!--d-->
14614 |}
14615 !!result
14616 <table>
14617 <tbody>
14618 <tr>
14619 <td> <!--c--></td></tr>
14620 <tr>
14621 <td><!--c--> <!--d--></td></tr>
14622 </table>
14623
14624 !!end
14625
14626 !!test
14627 Multi-line image caption generated by templates with/without trailing newlines
14628 !!options
14629 parsoid
14630 !!input
14631 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14632 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14633 !!result
14634 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
14635 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
14636
14637 !!end
14638
14639 ## PHP emits broken html for this, and since this is primarily
14640 ## a Parsoid serializer test, marking this Parsoid only
14641 !!test
14642 Improperly nested inline or quotes tags with whitespace in between
14643 !!options
14644 parsoid
14645 !!input
14646 <span> <s>x</span> </s>
14647 ''' ''x''' ''
14648 !!result
14649 <p><span> <s>x</s></span><s> </s>
14650 <b> <i>x</i></b><i> </i></span>
14651 </p>
14652 !!end
14653
14654 TODO:
14655 more images
14656 more tables
14657 character entities
14658 and much more
14659 Try for 100% code coverage